<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>i车商-智能营销生态系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <link href="http://x.cheshanghui.com.cn/dealer/ics/20150226A/Content/frame.css" rel="stylesheet" />
    <link href="http://x.cheshanghui.com.cn/dealer/ics/20150226A/Content/sundry.css" rel="stylesheet" />
    
</head>
<body>

<div class="g-header fn-clear">
    <div class="header-main">
        <div class="header-name">
            <a href="#" class="header-logo"><i class="icon icon-logo"></i></a>
            <i class="icon16 icon16-horn"></i>
            <span class="header-noticetit">网站公告：</span>
        </div>
            <div class="header-txt" id="scrollBullet">
                    <p>  <a href="http://ics.autohome.com.cn//BSS/Notice/Detail/172" class="header-notice">i车商产品培训资料更新通知。</a></p>
            </div>
       
        </div>
    <div class="header-sub">
        <div class="header-user">
            <ul class="user-ul">
                <li class="user-card"><span class="card-name">您好，系统管理员</span></li>
                <li class="user-card">
                    <a href="http://ics.autohome.com.cn//BSS/MyMch/PersonalInfo" class="card-name" title="修改密码"><i class="icon16 icon16-portrait"></i></a>
                </li>
                <li class="user-card">
                    <a href="http://ics.autohome.com.cn/passport/Account/LogOut" class="card-name" title="注销"><i class="icon16 icon16-out"></i></a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="g-nav fn-clear" id="g-nav">
    <a href="#" id="leftlink" class="nav-arrow arrow-left"><i class="icon16 icon16-jtl-orange"></i></a>
    <a href="#" id="rightlink" class="nav-arrow arrow-right"><i class="icon16 icon16-jtr-orange"></i></a>
    <div class="nav-menu" id="nav-menu">
        <ul class="menu-ul" id="menu-ul">
                    <li><a href='/passport/Home/Index' target="">主页<i class="icon-jt-top"></i></a></li>
                    <li><a href='/price' target="" class='current'><i class='icons icons-dealer'></i><i class="icon-jt-top"></i></a></li>
                    <li><a href='http://tuangou.autohome.com.cn' target="_blank"><i class="icons icons-groupon"></i><i class="icon-jt-top"></i></a></li>
                    <li><a href='/passport/home/LoginCSC?isnewwindow=1' target="_blank"><i class="icons icons-mall"></i><i class="icon-jt-top"></i></a></li>
                    <li><a href='/bss' target="">基础设置<i class="icon-jt-top"></i></a></li>
                    <li><a href='/dms' target="">客户管理<i class="icon-jt-top"></i></a></li>
                    <li><a href='/dss' target="">决策支持<i class="icon-jt-top"></i></a></li>
                    <li><a href='/onlineOrder' target="">在线签单<i class="icon-jt-top"></i></a></li>
        </ul>
    </div>
</div>
<script language="javascript" type="text/javascript">
    function ScrollText(content) {
        this.Delay = 100;
        this.Amount = 1;
        this.Direction = "up";
        this.Timeout = 1000;
        this.availHeight = 35;
        this.ScrollContent = this.gid(content);
        this.ScrollContent.innerHTML += this.ScrollContent.innerHTML;
        this.ScrollContent.onmouseover = this.GetFunction(this, "Stop");
        this.ScrollContent.onmouseout = this.GetFunction(this, "Start");
    }

    ScrollText.prototype.gid = function (element) {
        return document.getElementById(element);
    }
    ScrollText.prototype.Stop = function () {
        clearTimeout(this.AutoScrollTimer);
        clearTimeout(this.ScrollTimer);
    }
    ScrollText.prototype.Start = function () {
        clearTimeout(this.AutoScrollTimer);
        this.AutoScrollTimer = setTimeout(this.GetFunction(this, "AutoScroll"), this.Timeout);
    }

    ScrollText.prototype.AutoScroll = function () {

        if (this.Direction == "up") {
            if (parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2) {
                this.ScrollContent.scrollTop = 0;

            } else {
                this.ScrollContent.scrollTop += this.Amount;
            }


        } else {
            if (parseInt(this.ScrollContent.scrollTop) <= 0) {
                this.ScrollContent.scrollTop = this.ScrollContent.scrollHeight;

            } else {
                this.ScrollContent.scrollTop -= this.Amount;
            }

        }
        clearTimeout(this.ScrollTimer);
        this.ScrollTimer = setTimeout(this.GetFunction(this, "AutoScroll"), this.Delay);
    }

    ScrollText.prototype.GetFunction = function (variable, method) {
        return function () {
            variable[method]();
        }
    }
</script>



<div class="g-main f-clear">



<div class="g-subnav">
    <ul class="subnav-list-first" id="sysmenu">
            <li>
                <a href="/Price/#" hlurl="#" class="item-first-txt"><i class="u-icon22  u-icon22-message"></i>资讯管理</a>
                    <ul class="subnav-list-second" style="display: none">
                   
                            <li><a class="item-first-txt" hlurl="Price/News/Index" href="/Price/News/Index" >资讯列表</a></li>
                            <li><a class="item-first-txt" hlurl="Price/NewsTemplateSection1/index,Price/NewCar/index,Price/News/Edit" href="/Price/News/NewsRedirect" >发布资讯</a></li>
                            <li><a class="item-first-txt" hlurl="Price/News/Draft" href="/Price/News/Draft" >草稿箱</a></li>
                    
                    </ul>
            </li>
            <li>
                <a href="/Price/#" hlurl="#" class="item-first-txt"><i class="u-icon22  u-icon22-offer"></i>报价管理</a>
                    <ul class="subnav-list-second" style="display: none">
                   
                            <li><a class="item-first-txt" hlurl="Price/CarPrice/OnSale" href="/Price/CarPrice/OnSale" >车型报价</a></li>
                            <li><a class="item-first-txt" hlurl="Price/CarMainRecommend/Index" href="/Price/CarMainRecommend/Index" >主推车型</a></li>
                            <li><a class="item-first-txt" hlurl="Price/CarPrice/NotOnSale" href="/Price/CarPrice/NotOnSale" >未上市车型</a></li>
                            <li><a class="item-first-txt" hlurl="Price/CarPrice/OffSale" href="/Price/CarPrice/OffSale" >停售车型</a></li>
                    
                    </ul>
            </li>
            <li>
                <a href="/Price/#" hlurl="#" class="item-first-txt"><i class="u-icon22  u-icon22-store"></i>店铺管理</a>
                    <ul class="subnav-list-second" style="display: none">
                   
                            <li><a class="item-first-txt" hlurl="Price/SiteSet/Index" href="/Price/SiteSet/Index" >会员页设置</a></li>
                            <li><a class="item-first-txt" hlurl="Price/SiteSet/Company" href="/Price/SiteSet/Company" >公司介绍设置</a></li>
                    
                    </ul>
            </li>
    </ul>
</div>

    

    <div class="g-maincontainer">
        <div class="container">
            



<link href="http://x.cheshanghui.com.cn/dealer/ics/20150226A/Content/datetextbox.css" rel="stylesheet" type="text/css"/>
<div class="m-crumbs"><span>资讯管理</span>&nbsp;&gt;&nbsp; <span>发布资讯</span>&nbsp;&gt;&nbsp;  优惠促销模板</div>
<!-- start完整度 -->
<div class="m-progress" id="divBarcont1">
    <div class="progress-wrap" >
        <div class="progress-bar" style="width:70%">
        </div>
        <div class="progress-txt">文章完整度<span id="spScore">70</span>%</div>
    </div>
</div>
<!-- end完整度 -->
<div id="div_section1" class="g-con t-informationissue ml20 mr20">
    <div class="m-head">
        <h2>
            发布资讯
        </h2>
    </div>
    <div class="divide-D m_t10">
    </div>
    <div class="m-box2 mb10">
        
<div class="box2-con f-clear newsClasses">
    <!--先显式模板类-->
    <!--优惠促销模板-->

    <span class="mr20 zindex-10 templateClass">
        <label class="lbl_switchClass" classid="2" onclick="if (!confirmChangeTemplate(2, 1)) return false;">
            <input type="radio" class="radio rdoNewsClass" name="classType" value="2" pageurl="/Price/NewsTemplateSection1"
                   id="txt_t_2" checked="checked" />优惠促销
            (<span class='emphasize'>模板</span>)
        </label>
        <i class="u-icon12 u-icon12-wen" onmouseout="showClassInfo(1,0,2 )" onmouseover="showClassInfo(0,0,2)">
            <div class="m-tip" id="divClassTemplate2" style="display:none; width:330px; margin-top: -20px;margin-left: 15px" >
                <div class="tip-content">
                    文章查看人群： 意向购车用户<br />
                    用户感兴趣的：优惠的价格，赠送的礼包或购置税、保险。<br />文章露出位置：首页、分站页、经销商店铺页
                    <span class="tip-right tip-arrow"></span>
                </div>
            </div>
        </i>
        
    </span>
    <!--新车模板类-->
    <span class="mr20 zindex-9 templateClass">
        <label class="lbl_switchClass" classid="3" onclick="if(!confirmChangeTemplate(3, 1)) return false;" >
            <input type="radio" class="radio rdoNewsClass" name="classType" value="3" id="txt_t_3" pageurl="/Price/NewCar/index" />新车信息
            (<span class='emphasize'>模板</span>)
        </label>
        <i class="u-icon12 u-icon12-wen" onmouseout="showClassInfo(1,0,3 )" onmouseover="showClassInfo(0,0,3)">
            <div id="divClassTemplate3" class="m-tip" style="display:none; width:330px;margin-top: -20px;margin-left: 15px">
                <div class="tip-content">
                    文章查看人群： 意向购车用户<br />
                    用户感兴趣的：优惠的价格，赠送的礼包或购置税、保险。<br />文章露出位置：首页、分站页、经销商店铺页
                    <span class="tip-right tip-arrow" />
                </div>
            </div>
        </i>
    </span>
            <span class="mr20 zindex-8">
                <label class="lbl_switchClass" classid="1" onclick="if (!confirmChangeTemplate(1, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="1" id="txt_1" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=1">新闻资讯
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass1" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            文章查看人群： 准购车用户<br/>用户感兴趣的：车型更新的时间、优惠的价格等。<br/>
    文章露出位置：分站页、经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>
            <span class="mr20 zindex-7">
                <label class="lbl_switchClass" classid="2" onclick="if (!confirmChangeTemplate(2, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="2" id="txt_2" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=2">优惠促销
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass2" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            文章查看人群： 意向购车用户<br/>
用户感兴趣的：优惠的价格，赠送的礼包或购置税、保险。<br/>
文章露出位置：首页、分站页、经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>
            <span class="mr20 zindex-6">
                <label class="lbl_switchClass" classid="3" onclick="if (!confirmChangeTemplate(3, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="3" id="txt_3" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=3">新车信息
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass3" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            文章查看人群： 意向购车用户<br/>
    用户感兴趣的：优惠的价格，赠送的礼包或购置税、保险。<br/>
    文章露出位置：首页、分站页、经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>
            <span class="mr20 zindex-5">
                <label class="lbl_switchClass" classid="4" onclick="if (!confirmChangeTemplate(4, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="4" id="txt_4" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=4">维修保养
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass4" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            文章查看人群： 意向购车用户、已购车用户<br/>
    用户感兴趣的：保养的周期、价格。<br/>
    文章露出位置：分站页、经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>
            <span class="mr20 zindex-4">
                <label class="lbl_switchClass" classid="5" onclick="if (!confirmChangeTemplate(5, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="5" id="txt_5" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=5">招聘公告
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass5" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            用户感兴趣的：招聘的岗位，岗位的需求<br/>
    文章露出位置：经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>
            <span class="mr20 zindex-3">
                <label class="lbl_switchClass" classid="7" onclick="if (!confirmChangeTemplate(7, 0)) return false;">
                    <input name="classtype" class="radio rdoNewsClass" value="7" id="txt_7" name="classType" type="radio" pageurl="/Price/News/Edit?newsId=0&amp;classId=7">店内活动
                </label>
                <i class="u-icon12 u-icon12-wen">
                    <div id="divClass7" class="m-tip" style="display:none; width:320px;margin-top: -20px;margin-left: 15px">
                        <div class="tip-content">
                            用户感兴趣的：活动的内容、时间、地点。<br/>
    文章露出位置：经销商店铺页
                            <span class="tip-right tip-arrow" ></span>
                        </div>
                    </div>
                </i>
            </span>

</div>
 
    </div>
    <input data-val="true" data-val-number="The field SeriesScore must be a number." data-val-required="The SeriesScore field is required." id="seriesScore" name="SeriesScore" type="hidden" value="10" />
    <div class="mb15" id="divClass">
        <span class="emphasize mr20">使用优惠促销模板时，您只需要先选择和填写好相应的信息，系统会自动生成一篇文章供您预览和修改细节。</span>
    </div>
    <!--车系开始-->
    <div class="m-box2 mb10" id="divSeries">
        

<div class="box2-tit">
    选择车系：<span class="m_r30 danger" style="display: none;" id="spSeries"><i class="u-icon16 u-icon16-exc mr5"></i>请选择车系</span>
</div>
<div class="box2-con">
            <span class="cont-label">
                <label>
                        <input type="radio" class="radio rdoSeries" name='ckSeriesId' value="623" sname="北京40" />
                    北京40(有效期内<span class="fb danger">2</span>篇)
                </label>
            </span>
            <span class="cont-label">
                <label>
                        <input type="radio" class="radio rdoSeries" name='ckSeriesId' value="2252" sname="北京汽车E系列" />
                    北京汽车E系列(有效期内<span class="fb danger">2</span>篇)
                </label>
            </span>
            <span class="cont-label">
                <label>
                        <input type="radio" class="radio rdoSeries" name='ckSeriesId' value="3557" sname="绅宝D20" />
                    绅宝D20(有效期内<span class="fb danger">2</span>篇)
                </label>
            </span>
            <span class="cont-label">
                <label>
                        <input type="radio" class="radio rdoSeries" name='ckSeriesId' checked='checked' value="2791" sname="绅宝D50" />
                    绅宝D50(有效期内<span class="fb danger">2</span>篇)
                </label>
            </span>
            <span class="cont-label">
                <label>
                        <input type="radio" class="radio rdoSeries" name='ckSeriesId' value="2787" sname="绅宝D70" />
                    绅宝D70(有效期内<span class="fb danger">1</span>篇)
                </label>
            </span>
</div>
<input type="hidden" id="inventoryStateScoreseriesScore" name="seriesScore" />





    </div>
    <!--车系结束-->
    <!--加装车开始-->
    <div class="m-box2" id="divEquip">
        <div class="box2-tit">
            选择加装车：
            <span class="mr20 danger" id="spEquip" style="display: none;"><i class="u-icon16 u-icon16-exc mr5"></i>请选择加装</span>
        </div>
        <div class="box2-con f-clear">
            <span class="mr20">
                <label>
                    <input type="radio" id="txtNoEquipCar" class="radio" value="0" checked="checked"
                           onclick="checkEquipCar()" name="equipCar">不使用加装车
                </label>
            </span>
            <span class="mr20">
                <label>
                    <input type="radio" id="txtEquipCar" name="equipCar" value="1" onclick="checkEquipCar()"
                           class="radio">使用加装车
                </label>
            </span>
            <span class="emphasize">（提示：价格为区间的车型必须设置加装车后进行促销。)</span>
        </div>
    </div>

<div class="m-append" id="divEquipCar"   style="display: none;"    >

</div>    

    <!--加装车结束-->
    <!--现车开始-->
    <div class="m-box2 mb10" id="divinventoryState">
        <div class="box2-tit">
            设置现车情况：<span class="mr20 danger" style="display: none;"
      id="spinventoryState"><i class="u-icon16 u-icon16-exc mr5"></i>未选择现车情况</span>
        </div>
        <div class="box2-con f-clear" id="div_InventoryState">
            <span class="mr20">
                <label>
                    <input type="radio" class="radio" id="inventoryState0" value="0" name="inventoryState" tname="现车充足"
                           onclick="checkInventoryState()" checked="checked">现车充足
                </label>
            </span><span class="mr20">
                <label>
                    <input type="radio" class="radio" id="inventoryState1" value="1" name="inventoryState" tname="少量现车"
                           onclick="checkInventoryState()">少量现车
                </label>
            </span><span class="mr20">
                <label>
                    <input type="radio" class="radio" id="inventoryState2" value="2" name="inventoryState" tname="无现车需预订"
                           onclick="checkInventoryState()">需要预订
                </label>
            </span> 
        </div>
        <input type="hidden" id="inventoryStateScore" name="inventoryStateScore" value="10" />
    </div>
    <!--现车结束-->
    <!--设置现金优惠开始-->
    

<div class="m-box2 mb10 f-clear" id="divPrice">
    <div class="box2-left">
        <div class="box2-tit">
            设置现金优惠：<span class="mr20 danger" id="spPriceOff" style="display: none;"><i class="u-icon16 u-icon16-exc mr5"></i>现金优惠或补贴只能为3位数字</span>
        </div>
        <div class="box2-con f-clear">
            <span class="mr20">
                <label><!--新资讯默认为优惠-->
                    <input type="radio" checked="checked" value="1" name="IsPriceOff" id="radCu" class="radio" >优惠
                </label>
            </span>
            <span class="mr20">
                <label>
                    <input type="radio" value="0" name="IsPriceOff" id="radJia" class="radio">加价
                </label>
            </span>
            <span class="mr20">
                <input id="priceoff" name="priceoff" type="text" maxlength="6" class="input w-150" minprice="68800" maxprice="111800"
                       minoriginalprice="74800" value="0.8" percentvalue="0"
                       onkeyup="priceoffKeyup()" onblur="checkPrice()"> 万元
            </span>
        </div>
    </div>
    <div class="box2-right">
        <i class="informationissue-iconkuo" ></i>
        <div class="informationissue-subsidy">
            <span class="mr20 mb5">
                含厂商补贴<input type="text" class="input w-100" id="txtFactorySubsidyPrice"
                            name="txtFactorySubsidyPrice" value="" maxlength="6"
                            onkeyup="priceKeyup(this,0)" onblur="showPriceMessage(this,0)"> 万元
            </span>
            <span class="mr20 mb5">
                含政府补贴
                <input type="text" class="input w-100" id="txtGovSubsidyPrice" maxlength="6" name="txtGovSubsidyPrice"
                       value="" onkeyup="priceKeyup(this,0)" onblur="showPriceMessage(this,0)"> 万元
            </span>
        </div>
        <div class="informationissue-subsidy">
            <span class="mr20 mb5">
                含惠民补贴<input type="text" class="input w-100" id="txtAllowancePrice" maxlength="6" name="txtAllowancePrice"
       onkeyup="priceKeyup(this,0)" onblur="showPriceMessage(this,0)" value=""> 万元
            </span>
        </div>
    </div>
</div>

 
    <!--设置现金优惠结束-->

    <div class="m-box2 mb10" id="divExchange">
        <div id="divExchangeState" class="box2-tit">
            设置置换补贴：
        </div>
        <div class="box2-con f-clear">
            <span class="mr20">
                补贴金额：<input type="text" class="input w-100 intNum wanyuan" id="txtExchangeSubsidyPrice"
                            name="txtExchangeSubsidyPrice" value="0" maxlength="6">&nbsp;元
            </span><span class="emphasize mr20">（提示：“置换补贴”专为有置换需求的购车用户设置，补贴金额暂不计入购车成交价）</span>
        </div>
    </div>
    <div class="m-box2 mb10" id="divOther">
        <div id="divotherState" class="box2-tit">
            设置必要花费：<span class="box2-con f-clear danger" id="spOtherPrice" style="display: none;"><i class="u-icon16 u-icon16-exc mr5"></i>金额必须为整数</span>
        </div>
        <div class="box2-con f-cleart">
            <span class="mr20">
                上牌费：<input id="LicenseTax" name="LicenseTax" value="0" type="text" class="input w-150 intNum" maxlength="6" />&nbsp;元
            </span>
            <span class="mr20">
                其它：
                <input id="OtherPrice" name="OtherPrice" type="text" value="0" class="input w-150 intNum" maxlength="6" />&nbsp;元
                <span class="emphasize">（提示：“其它”是客户购车的额外附加费用，用于计算成交价，请谨慎添加）</span>
            </span>
        </div>
    </div>
    <!--设置赠送优惠开始-->
    <!--赠送优惠-->
 
<div class="m-box2 mb10" id="divHui">
    <div class="box2-tit">
        设置赠送优惠：<span class="mr20 danger" id="spHui" style="display: none;"><i class="u-icon16 u-icon16-exc mr5"></i>店内保险优惠不能超过商业保险总额</span>
    </div>
    <div class="inforsel-cont">
        <span class="mr20">
            购置税：<select class="select w-130" id="selPurchaseTax" name="selPurchaseTax">
                <option value="0">不赠送购置税</option>
                <option value="50">赠送50%购置税</option>
                <option value="100">赠送100%购置税</option>
            </select>
        </span>
        <span class="mr20">
            交强险：
            <select class="select w-130" id="selCompulsoryInsurance" name="selCompulsoryInsurance">
                <option value="0">不赠送交强险</option>
                        <option value="1">赠送1年交强险</option>
                        <option value="2">赠送2年交强险</option>
                        <option value="3">赠送3年交强险</option>
                        <option value="4">赠送4年交强险</option>
                        <option value="5">赠送5年交强险</option>
                        <option value="6">赠送6年交强险</option>
                        <option value="7">赠送7年交强险</option>
                        <option value="8">赠送8年交强险</option>
                        <option value="9">赠送9年交强险</option>
            </select>
        </span>

        <span class="mr20">
            商业险：
            <select class="select w-130" id="selCommercialInsurance" name="selCommercialInsurance">
                <option value="0">不赠送商业险</option>
                        <option value="1">赠送1年商业险</option>
                        <option value="2">赠送2年商业险</option>
                        <option value="3">赠送3年商业险</option>
                        <option value="4">赠送4年商业险</option>
                        <option value="5">赠送5年商业险</option>
                        <option value="6">赠送6年商业险</option>
                        <option value="7">赠送7年商业险</option>
                        <option value="8">赠送8年商业险</option>
                        <option value="9">赠送9年商业险</option>
            </select>
        </span><span class="mr20">
            店内保险优惠：<input type="text" class="input w-150" id="txtInsuranceDiscount"
                          maxlength="6" onkeyup="priceKeyup(this,1)" onblur="showPriceMessage(this,1)"
                          name="txtInsuranceDiscount" value="0" />万元
        </span> <span class="mr20">
            <label for="chkHasDealerInsurance">
                <input type='checkbox' class="checkbox" id="chkHasDealerInsurance" name="chkHasDealerInsurance">必须店内上保险
            </label>
        </span>
    </div>
</div>


    <!--设置赠送优惠结束-->

    <div class="m-box2" id="divPack">
        <div class="box2-tit">
            礼包设置：<span class="mr20 danger" style="display: none;" id="spPackAge"><i class="u-icon16 u-icon16-exc mr5"></i>请选择礼包</span>
        </div>
        <div class="box2-con f-clear">
            <span class="mr20">
                <label>
                    <input type="radio" class="radio" id="noUserPackage" value="0" checked="checked"
                           name="package" onclick="checkPackAge()">不赠送礼包
                </label>
            </span> <span class="mr20">
                <label>
                    <input type="radio" id="userPackage" value="1" class="radio" name="package" onclick="checkPackAge()">赠送礼包
                </label>
            </span>
        </div>
    </div>

    <div class="m-append" id="divPackAge"   style="display: none;"    >
</div>

    <div class="m-box" id="divTime">
        <div class="box-tit">
            <span class="fb f14px">请选择有效期：</span><span class="emphasize">（提示：为避免网友反复咨询早期的促销信息，请准确填写此次优惠的促销期限）</span>
            <span class="mr20 danger" style="display: none;" id="spTime">
                <i class="u-icon16 u-icon16-exc mr5"></i>
                请选择有效期
            </span>
        </div>
        <div class="box-con informationissue-validity">
            <dl class="m-control mb10">
                <dt>文章有效期：</dt>
                <dd>
                    <span>
                        <input class="u-input mr5" type="text" id="txtstarttime" onclick="showCalendar('txtstarttime', 'y-mm-dd')"
                               value="2015-03-20" />
                    </span>
                    <i class="u-icon16 u-icon16-timer" onclick="showCalendar('txtstarttime', 'y-mm-dd')"></i>
                    至
                    <input class="u-input mr5" type="text" id="txtendtime" onclick="showCalendar('txtendtime', 'y-mm-dd')"
                           value="2015-03-20" />
                    <i class="u-icon16 u-icon16-timer" onclick="showCalendar('txtendtime', 'y-mm-dd')"></i>
                </dd>
            </dl>
            <dl class="m-control mb10">
                <dt>关联店辅：</dt>


<dd>
            <span class="mr20">
                <label for="associatedStore1">
                    <input id="associatedStore1" class="checkbox associatedStore" name="associatedStore" type="checkbox" value="85267" checked="checked" />
                    [4s]中拓瑞博-北京汽车店
                </label>
            </span>
  
</dd>

            </dl>

            <dl class="m-control informationissue-recommend">

                <dt>推荐位置：</dt>
                <dd>
                    <label for="home">
                        <input class="checkbox" name="home" type="checkbox" id="chk_isRecommend"
                               customlastcount="2" />
                        推荐至汽车之家页面（消耗名额<span class="fb danger">3</span>；
                        剩余名额<span class="fb danger" id="span_recomm_totalLastCount" totalcount="10">7</span>）
                    </label>
                </dd>

                <dd>
                    <label for="chk_memberFocus">
                        <input class="checkbox" name="chk_memberFocus" type="checkbox" id="chk_memberFocus" checked="checked" />
                        添加至会员页焦点图
                    </label>

                    <label for="bullet" id="dtBullet">
                        <input type="checkbox" name="bullet" id="bullet" value="1" class="checkbox" checked="checked" />
                        添加至公告板
                    </label>
                </dd>
                <dd>
                    <span class="emphasize">温馨提示：早8：30至晚17：30之间发布推荐的文章，当天审核完毕，非工作时间及节假日除外。</span>
                </dd>
                <dd>
                    <a class="mr15" target="_blank" href="/Price/News/RecommendNew">推荐文章展现位置</a>
                    <a class="mr15" target="_blank" href="/Price/News/RecommendNew#reRule">推荐文章展示规则</a>
                    <a class="mr15" target="_blank" href="/Price/News/RecommendNew#reStand">推荐文章审核标准</a>
                </dd>

            </dl>
        </div>
    </div>


    <div class="m-btns">
        <a class="u-btn u-btn-mini mr20" href="javascript:void(0)" id="btnNext" onclick="next(12949247)">下一步</a>
    </div>
</div>

<input type="hidden" id="templateId" value="12949247" />
<input type="hidden" id="seriesId" value="2791" />
<input type="hidden" id="classId" value="" />
<input id="PackageIds" type="hidden" value="" />
<input id="equipCarIds" type="hidden" value="" />
<input type="hidden" name="companyId" id="companyId" value="85267" />

<div id="div_section2" class="g-con t-informationissue ml20 mr20" style="display: none">
    <style>
        body{ min-width:1600px;}
    </style>
    

<div id="section2">

<div class="m-box1 mb10 informationissuepic-article">
    <h3 class="box-tit">文章表格预览</h3>
    <div class="box-handle">
        <dl class="m-control">
            <dt>选择车型：</dt>
            <dd class="informationissuepic-vehicle">
                <label class="mr10"><input type="checkbox" yearid="0" class="specyearall checkbox" name="carType"/>全部</label>
                                <label class="mr10" style="display:none"><input type="checkbox" class="specyear" checked="checked" specyear="2015" yearid="6524" name="carType" />2015 款</label>
    <input type="hidden" id="yearid" maxyearid="6524" value="6524"  />
<label class="mr10" style="display:none"><input type="checkbox" class="specyear" specyear="2014" yearid="5716" name="carType" />2014 款</label>


                <a href="javascript:void(0);" onclick=" ResetSpecData(); " class="u-btn u-btn-mini u-btn-small mr10">重新加载车型</a><span class="emphasize">修改选择的车型后，请点击重新加载车型对列表进行刷新，点击后您之前单独设置过的表格内容将会刷新，请谨慎操作。</span>
            </dd>
        </dl>
    </div>
    <div class="box-data">
        <div class="m-table2 mb10">
            <table>
                <thead>
                <tr>
                    <th width="12%">车型</th>
                    <th width="7%">厂商指导价</th>
                    <th width="16%">现金优惠</th>
                    <th width="5%">裸车价</th>
                    <th width="14%">赠送优惠</th>
                    <th width="11%">必要花费</th>
                    <th width="6%">参考成交价</th>
                    <th width="9%">赠送礼包</th>
                    <th width="10%">现车情况</th>
                    <th width="10%">操作</th>
                </tr>
                </thead>
                <tbody data-bind="foreach:SpecInfos">
                <tr data-bind="visible:Status()==0">
                    <td>
                        <p data-bind="text:$parent.SeriesName()+' '+SpecName()"></p>
                        <a class="u-btn u-btn-mini mt5" data-bind="visible:IsEquipCar()==1" href="javascript:void(0)">加装</a>
                    </td>
                    <td data-bind="text:OriginalPrice().towanyuan(2)+'万元'"></td>
                    <td>
                        <div data-bind="visible: EditPriceOff">
                            <p><span data-bind="visible:IsPriceOff()==0">现金加价：↑</span><span data-bind="visible:IsPriceOff()==1">现金优惠：↓</span><span data-bind="text:PriceOffTxt"></span>万元
                            </p>
                            <p data-bind="visible:FactorySubsidyPriceTxt()>0">含厂商补贴：<span data-bind="text:FactorySubsidyPriceTxt"></span>万元
                            </p>
                            <p data-bind="visible:GovSubsidyPriceTxt()>0">含政府补贴：<span data-bind="text:GovSubsidyPriceTxt"></span>万元
                            </p>
                            <p data-bind="visible:AllowancePriceTxt()>0">含惠民补贴：<span data-bind="text:AllowancePriceTxt"></span>万元
                            </p>
                            <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:ModifyPriceOff" href="javascript:void(0)">修改价格</a>
                        </div>
                        <div data-bind="visible: EditPriceOff()==false">
                            <ul class="revisecont">
                                <li class="mb5"><span class="m_r30"><label><input type="radio" data-bind="checked:IsPriceOff,attr:{name:SpecId()+EquipCarId()+'specIsPriceOff'}" value="1" checked="checked" class="radio specIsPriceOff">优惠</label></span>        <span><label><input type="radio" data-bind="checked:IsPriceOff,attr:{name:SpecId()+EquipCarId()+'specIsPriceOff'}" class="radio specIsPriceOff" value="0">加价</label></span> </li>
                                <li class="mb5"><input type="text" class="input w-price-01 specPriceOff wanyuan" onblur="priceKeyup(this, 0)" data-bind="value:PriceOffTxt" maxlength="6"> 万元</li>
                                <li class="mb5">包括以下价格：</li>
                                <li class="mb5">含厂商补贴：<input type="text" class="input wid40 specFactorySubsidyPrice wanyuan" data-bind="value:FactorySubsidyPriceTxt" maxlength="6"> 万元</li>
                                <li class="mb5">含政府补贴：<input type="text" class="input wid40 specGovSubsidyPrice wanyuan" data-bind="value:GovSubsidyPriceTxt" maxlength="6"> 万元</li>
                                <li class="mb5">含惠民补贴：<input type="text" class="input wid40 specAllowancePrice wanyuan" data-bind="value:AllowancePriceTxt" maxlength="6"> 万元</li>
                                <li class="mb5"><a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:SavePriceOff" href="javascript:void(0)">修改</a> <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="attr:{PriceOff:PriceOff(),FactorySubsidyPrice:FactorySubsidyPrice(),GovSubsidyPrice:GovSubsidyPrice(),AllowancePrice:AllowancePrice(),id:'priceoff'+SpecId()},click:RestorePriceOff" href="javascript:void(0)">取消</a></li>
                            </ul>
                        </div>
                    </td>
                    <td data-bind="text:CarPrice().towanyuan(2)+'万元'"></td>
                    <td>
                        <div data-bind="visible: EditInsurance">
                            <p data-bind="text:PurchaseTaxTxt"></p>
                            <p data-bind="text:CompulsoryInsuranceTxt"></p>
                            <p data-bind="text:CommercialInsuranceTxt"></p>
                            <p data-bind="text:InsuranceDiscountTxt"></p><a class="u-btn u-btn-mini mt5" data-bind="click:ModifyInsurance" href="javascript:void(0)">修 改</a>
                        </div>
                        <div data-bind="visible: EditInsurance()==false">
                            <ul class="revisecont">
                                <li class="mb5">购&nbsp;置&nbsp;税：<select class="select wid80 purchasetax" data-bind="value:PurchaseTax"><option value="0">不赠送</option><option value="50">50%</option><option value="100">100%</option></select></li>
                                <li class="mb5">交&nbsp;强&nbsp;险：<select class="select wid80 compulsoryinsurance" data-bind="value:CompulsoryInsurance"><option value="0">不赠送</option><option value="1">1年</option><option value="2">2年</option><option value="3">3年</option><option value="4">4年</option><option value="5">5年</option><option value="5">5年</option><option value="6">6年</option><option value="7">7年</option><option value="8">8年</option><option value="9">9年</option></select></li>
                                <li class="mb5">商&nbsp;业&nbsp;险：<select class="select wid80 commercialinsurance" data-bind="value:CommercialInsurance"><option value="0">不赠送</option><option value="1">1年</option><option value="2">2年</option><option value="3">3年</option><option value="4">4年</option><option value="5">5年</option><option value="5">5年</option><option value="6">6年</option><option value="7">7年</option><option value="8">8年</option><option value="9">9年</option></select></li>
                                <li class="mb5">保险优惠：<input type="text" class="input wid40 insurancediscount wanyuan" data-bind="value:InsuranceDiscountValue"  maxlength="6"> 万元</li>
                                <li class="mb5"><a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:SaveInsurance" equipcarid="0" specid="18639">修改</a> <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:RestoreInsurance" equipcarid="0" specid="18639">取消</a></li>
                            </ul>
                        </div>
                    </td>
                    <td>
                        <div data-bind="visible: EditOther">
                            <p>车船税：<span data-bind="text:VehicleTaxPrice"></span>元
                            </p>
                            <p>上牌费：<span data-bind="text:LicenseTaxPrice"></span>元
                            </p>
                            <p>其 它：<span data-bind="text:OtherPrice"></span>元
                            </p>
                            <a class="u-btn u-btn-mini mt5" data-bind="click:ModifyOther" href="javascript:void(0)">修 改</a>
                        </div>
                        <div data-bind="visible: EditOther()==false">
                            <ul class="revisecont">
                                <li class="mb5">车船税：<input type="text" class="input wid40 vehicleTaxPrice intNum" data-bind="value:VehicleTaxPrice" maxlength="6"></li>
                                <li class="mb5">上牌费：<input type="text" class="input wid40 licenseTaxPrice intNum" data-bind="value:LicenseTaxPrice" maxlength="6"></li>
                                <li class="mb5">其&nbsp;&nbsp;它：<input type="text" class="input wid40 otherPrice intNum" data-bind="value:OtherPrice" maxlength="6"></li>
                                <li class="mb5"><a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:SaveOther">修改</a> <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:RestoreOther">取消</a></li>
                            </ul>
                        </div>
                    </td>
                    <td data-bind="text:DealPrice().towanyuan(2)+'万元'"></td>
                    <td>
                        <select id="selectgifts" class="select wid75" data-bind="options: $parent.Gifts,
                       optionsText: 'Name',
                       optionsValue:'Id',
                       value:PackageId,visible:$parent.HasGiftPackage()==1"></select>
                    </td>
                    <td>
                        <div>
                            <p>
                                <select class="select wid80" data-bind="value:InventoryState"><option value="0">现车充足</option><option value="1">少量现车</option><option value="2">需要预订</option></select>
                            </p>
                            <p data-bind="text:InventoryColor"></p>
                            <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:ModifyColor,visible:EditColor()" href="javascript:void(0)">修改颜色</a>
                        </div>
                        <div data-bind="visible: EditColor()==false,attr:{id:SpecId()+'color'}">
                            <ul class="revise-cont" data-bind="foreach:$parent.SeriesColor">
                                <li><input type="checkbox" data-bind="attr:{colorname:$data.name,id:$data.id}" class="checkbox specColor"><label data-bind="text:$data.name"></label></li>
                            </ul>
                            <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:SaveColor">修改</a> <a class="u-btn u-btn-mini u-btn-small mt5" data-bind="click:RestoreColor">取消</a>
                        </div>
                    </td>
                    <td><a class="u-btn u-btn-mini u-btn-orange" data-bind="click:DeleteSpec" href="javascript:void(0)">删 除</a></td>
                </tr>
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="10" align="center"><span class="emphasize mr10">提示：如果您不小心删除了需要显示的车型，可以点击这里</span><a id="showSpec" class="u-btn u-btn-mini u-btn-small u-btn-orange" href="javascript:void(0)">恢复加载</a></td>
                </tr>
                <tr>
                    <td colspan="2" align="center">置换补贴：</td>
                    <td colspan="8">补贴金额：<input type="text" class="input intNum"  data-bind="value:ExchangeSubsidyPrice" /> 元</td>
                </tr>
                </tfoot>
            </table>
            <table id="PacksInfo" data-bind="visible:HasEquipCar()==1||HasGiftPackage()==1">
                <tbody>
                <tr id="PacksInfo1" data-bind="visible:HasEquipCar()==1">
                    <td width="200">
                        加装
                    </td>
                    <td class="text-left" style="padding: 0px;">
                        <ul id="equipCarUl" data-bind="foreach:EquipCars"><li data-bind="text:Content"></li></ul>
                    </td>
                </tr>
                <tr id="PacksInfo2" data-bind="visible:HasGiftPackage()==1">
                    <td>
                        赠送礼包
                    </td>
                    <td class="text-left" style="padding: 0px;">
                        <ul id="packageUl" data-bind="foreach:Gifts"><li data-bind="text:Content"></li></ul>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="t-information-issue-mark">
            <p class="mb10">优惠备注</p>
            <textarea class="informationissuepic-textarea" id="comment" onfocus=" if (this.value == '如优惠规则或礼包涵盖内容') {this.value = '';}this.style.color = 'black'; "
                      onblur=" if (this.value == '') {this.value = '如优惠规则或礼包涵盖内容';} this.style.color = '#999'; "></textarea>
        </div>
    </div>
</div>
<div class="m-box1 mb10">
    <h3 class="box-tit">维修保养</h3>
    <div class="box-data" id="weixiu">
        <div data-bind="foreach:MaintainEngines" class="m-table2 t-information-issue-insure mb10">
            <table>
                <thead>
                    <tr>
                        <th colspan="4">
                            <div class="informationissuepic-maintain">
                                <span class="mr10">保养信息</span><a href="javascript:void(0)" id="maincontrol" onclick=" changeMaintan() " isshow="0" class="u-btn u-btn-mini u-btn-orange">不使用</a>
                            </div>
                        </th>
                    </tr>
                </thead>
                <tbody id="matainceInfo">
                    <tr>
                        <td>
                            <div>
                                质保期
                            </div>
                        </td>
                        <td>
                            <select id="WarrantyYear" data-bind="value:WarrantyYear" class="select" style="visibility: visible;">
                                <option value="0">请选择年份</option>
                                <option value="1">一年</option>
                                <option value="2">二年</option>
                                <option value="3">三年</option>
                                <option value="4">四年</option>
                                <option value="5">五年</option>
                                <option value="6">六年</option>
                                <option value="7">七年</option>
                                <option value="8">八年</option>
                                <option value="9">九年</option>
                                <option value="10">十年</option>
                            </select>年或<input id="WarrantyKm" type="text" onkeyup=" priceKeyup(this, 0) " class="input intNum" maxlength="10">公里&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF0000">填写0公里代表不限公里</span>
                        </td>
                        <td>
                            <div>
                                店内建议保养周期
                            </div>
                        </td>
                        <td>
                            <span>
                                <label>
                                    <input type="radio" id="DealerWarrantyKm1" name="DealerWarrantyKm" value="5000" class="radio">5000公里
                                </label>
                            </span>
                            <span>
                                <label>
                                    <input type="radio" id="DealerWarrantyKm2" name="DealerWarrantyKm" value="7500" class="radio">7500公里
                                </label>
                            </span>
                            <span>
                                <label>
                                    <input type="radio" id="DealerWarrantyKm3" name="DealerWarrantyKm" value="10000" class="radio">10000公里
                                </label>
                            </span>
                            <span>
                                <label>
                                    <input type="radio" id="DealerWarrantyKm4" name="DealerWarrantyKm" value="0" class="radio">其它
                                </label>
                                <input type="text" id="DealerWarrantyKm4value" onkeyup=" priceKeyup(this, 0) " name="DealerWarrantyKmQita" class="input w-100 intNum wanyuan" maxlength="10">公里
                            </span>
                        </td>
                    </tr>
                    <tr class="wx2" style="">
                        <td>
                            <div>
                                更换机油机滤费用
                            </div>
                        </td>
                        <td>
                            <input type="text" id="EngineOil" class="input intNum" onkeyup=" priceKeyup(this, 0) " maxlength="10">元左右（以4S店价格为准）&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF0000">填写0元代表质保期内免费</span>
                        </td>
                        <td>
                            <div>
                                更换机油三滤费用
                            </div>
                        </td>
                        <td>
                            <input type="text" id="EngineOil3" class="input intNum" onkeyup=" priceKeyup(this, 0) " maxlength="10">元左右（以4S店价格为准）&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF0000">填写0元代表质保期内免费</span>
                        </td>
                    </tr>
                </tbody>
                <thead>
                    <tr>
                        <th colspan="4">保险信息</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>店内提供保险公司</td>
                        <td><label class="mr10"><input type="checkbox" class="checkbox insuranceCompany" name="中保" />中保</label><label class="mr10"><input class="checkbox insuranceCompany" name="人保" type="checkbox" />人保</label><label class="mr10"><input type="checkbox" class="checkbox insuranceCompany" name="平安" />平安</label><label><input type="checkbox" class="checkbox insuranceCompany" name="其它" />其它</label></td>
                        <td>保险费用</td>
                        <td><input type="text" data-bind="value:InsurancePrice" onkeyup=" priceKeyup(this, 0) " class="input intNum" /> 元左右（以4S店价格为准）</td>
                    </tr>
                </tbody>
                <thead>
                    <tr>
                        <th colspan="4">贷款信息</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>金融公司</td>
                        <td><input type="text" data-bind="value:FinanceCompany" class="input" /></td>
                        <td>贷款方式</td>
                        <td><label class="mr10">首付：<input type="text" class="input intNum" onkeyup=" priceKeyup(this, 0) " data-bind="value:LoanPayment" /> %</label><label class="mr10">时间：<input type="text" data-bind="value:LoanMonth" onkeyup=" priceKeyup(this, 0) " class="input intNum" /> 月</label><label class="mr10">月供：<input type="text" data-bind="value:LoanMonthPrice" onkeyup=" priceKeyup(this, 0) " class="input intNum" /> 元左右</label></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div class="m-box1 mb10">
    <h3 class="box-tit">文章内容</h3>
    <div class="box-data">
        <dl class="m-control mb10">
            <dt>标题：</dt>
            <dd>
                <select id="title" data-bind="options: Titles,
                       optionsText: 'TitleText',
                       optionsValue:'TitleValue',                       
                       Text:Title">
                    >
                </select>
                <span><input class="input wid370 mr10" id="txtTitle" data-bind="value:Title" type="text" /></span>
                <span style="display:inline-block">
                    <span class="mr20"><label><input type="checkbox" name="isAutoTitle" id="isAutoTitle"  class="checkbox" /> 使用自定义标题</label></span>        
                    <span class="emphasize">提示：推荐文章使用自定义标题必须16-18字，需人工审核，会影响在汽车之家页面及时显示。</span>
                </span>                                                                          
                <span id="spSignTitle" style="display: none;" class="fred">请不要使用“”：-！以外的标点</span>
            </dd>
        </dl>
        <dl class="m-control mb10">
            <dt>短标题：</dt>
            <dd><span><input id="subTitle" disabled="disabled" style="width: 150px;" data-bind="value:SubTitle" class="u-input2 wid150 mr10" type="text" /></span><span class="emphasize">提示：短标题会被提取到网站首页，请注意内容完整度，字数在10-11字范围内！</span></dd>
        </dl>
        <dl class="m-control mb10 informationissuepic-content">
            <dt>内容：</dt>
            <dd>
                <span><textarea data-bind="value:Content" maxlength="1000" class="mr10"></textarea></span><span class="emphasize">提示：可简单说明店内促销方式及规模或相关促销规则。</span>
                
            </dd>
        </dl>
        <dl class="m-control mb10 informationissuepic-content">
            <dt>展示大图：</dt>
            <dd>
                <span class="m-showpic" data-bind="click:SelectPicture,visible:BigNewsTemplateImage().ImageUrl()==''">    该类别目前没有对应的展示图片<br>请<a class="blueLink">上传图片</a></span>
                <span class="m-showpic" data-bind="click:SelectPicture,visible:BigNewsTemplateImage().ImageUrl()!=''"><a class="showpic-pic"><img data-bind="attr:{src:BigNewsTemplateImage().SmallImageUrl,id:'image'+BigNewsTemplateImage().Id()}" width="120" height="90" /><span class="showpic-shadow"></span><span class="showpic-txt">点击修改图片</span></a></span>
            </dd>
        </dl>
        <dl class="m-control mb10 informationissuepic-content">
            <dt>展示小图：</dt>
            <dd data-bind="foreach:NewsTemplateImages">
                <span class="m-showpic" data-bind="click:SelectPicture,visible:ImageUrl()==''" style="vertical-align:top">    该类别目前没有对应的展示图片<br>请<a class="blueLink">上传图片</a></span>
                <span class="m-showpic" data-bind="click:SelectPicture,visible:ImageUrl()!=''"><a class="showpic-pic"><img data-bind="attr:{src:SmallImageUrl,id:'image'+Id()}" width="120" height="90" /><span class="showpic-shadow"></span><span class="showpic-txt">点击修改图片</span></a></span>
            </dd>
        </dl>
        <dl class="m-control mb10 informationissuepic-content">
            <dt>焦点图：</dt>
            <dd>
                <span class="m-showpic" data-bind="click:FocusSelectPicture,visible:FocusImage().ImageUrl()==''">    该类别目前没有对应的展示图片<br>请<a class="blueLink">上传图片</a></span>
                <span class="m-showpic" data-bind="click:FocusSelectPicture,visible:FocusImage().ImageUrl()!=''"><a class="showpic-pic"><img data-bind="attr:{src:FocusImage().SmallImageUrl,id:'image'+FocusImage().Id()}" width="120" height="90" /><span class="showpic-shadow"></span><span class="showpic-txt">点击修改图片</span></a></span>
            </dd>
        </dl>
        <dl class="m-control mb10 publishedcar-content">
            <dt>本店特色：</dt>
            <dd>
                <span><textarea maxlength="1000" data-bind="value:Conclusion" class="mr10"></textarea></span>
                <span class="emphasize">提示：可填写公司附加增值性服务如保险保养或贷款等。</span>
                
            </dd>
        </dl>
        <dl class="m-control mb10 informationissuepic-content">
            <dt>公司信息：</dt>
            <dd>
                <label class="mr20"><input type="checkbox" checked="checked" data-bind="checked:HasPhone" class="checkbox"/>添加公司销售电话</label>
                <label class="mr20"><input type="checkbox" checked="checked" data-bind="checked:HasAddress" class="checkbox" />添加公司地址</label>
            </dd>
        </dl>
    </div>
</div>
<div class="m-btns">
    <a class="u-btn u-btn-mini mr20" id="publishbtn" data-bind="click:SaveAllData">发布</a>
    <a class="u-btn u-btn-mini mr20" id="draftbtn" data-bind="click:SaveDraft">存草稿</a>
    <a class="u-btn u-btn-mini" data-bind="click:Preview">预览</a>
    <a target="_blank" id="preview_url" style="display: none"></a>
</div>
</div>

<script type="text/javascript">
    var viewmodel;
    //车系颜色
    var SeriesColor = [{"id":1,"name":"颜色齐全","value":"#XXXXX","picnum":1,"clubpicnum":1},{"id":3192,"name":"珠光白","value":"#F3F3F3","picnum":358,"clubpicnum":61},{"id":3194,"name":"极光银","value":"#808080","picnum":183},{"id":3195,"name":"铂金灰","value":"#9F9F9F","picnum":144,"clubpicnum":3},{"id":3193,"name":"墨玉黑","value":"#1C1C1C","picnum":14,"clubpicnum":14},{"id":3784,"name":"冰晶蓝","value":"#0873AD","picnum":8,"clubpicnum":8},{"id":3599,"name":"熔岩红","value":"#980033","picnum":1,"clubpicnum":1},{"id":3783,"name":"琥珀金","value":"#685B52"}];

    //车系图片json
    var Pics=[{"yearId":4006,"seriesId":2791,"smallPics":[]},{"yearId":5716,"seriesId":2791,"bigPic":{"id":1,"picfilepath":"http://car0.autoimg.cn/car/upload/2014/12/11/20141211203921060547210.jpg","picid":2815240,"imageType":1,"specname":"2014款 1.5L CVT标准版"},"smallPics":[{"id":11,"picfilepath":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014247497547211.jpg","picid":2814124,"specname":"2014款 1.5L CVT标准版"},{"id":12,"picfilepath":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014240740547210.jpg","picid":2814122,"specname":"2014款 1.5L CVT标准版"},{"id":13,"picfilepath":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014153861547211.jpg","picid":2814108,"specname":"2014款 1.5L CVT标准版"},{"id":14,"picfilepath":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014156935547211.jpg","picid":2814109,"specname":"2014款 1.5L CVT标准版"}]},{"yearId":6524,"seriesId":2791,"smallPics":[]}];

    //大图
    var  BigPicJson={"id":1,"imageId":2814265,"imageUrl":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014719387547211.jpg","imageType":1,"orderId":1};
    var SmallPicJson=[{"id":11,"imageId":2814263,"imageUrl":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014715780547210.jpg","orderId":2},{"id":12,"imageId":2815240,"imageUrl":"http://car0.autoimg.cn/car/upload/2014/12/11/20141211203921060547210.jpg","orderId":3},{"id":13,"imageId":2814263,"imageUrl":"http://car0.autoimg.cn/car/upload/2014/12/13/20141213014715780547210.jpg","orderId":4},{"id":14,"imageId":2355217,"imageUrl":"http://car0.autoimg.cn/carnews/2014/3/12/201403121838311725063.jpg","orderId":5}];
    var FocusPicJson={"id":2,"imageId":2431444,"imageUrl":"http://car0.autoimg.cn/carnews/2014/4/23/201404230947142445203.jpg","imageType":2,"orderId":1};

    //维修信息
    var MaintainEngineJson={"id":29406,"companyId":85267,"seriesId":2791,"warrantyYear":2,"warrantyKm":0,"dealerWarrantyKm":0,"engineOil":0,"engineOil3":-1,"insuranceCompany":"","insurancePrice":0,"financeCompany":"","loanPayment":0,"loanMonth":0,"loanMonthPrice":0,"createTime":"2014-05-23T10:25:17.603","lastTime":"2015-03-19T09:29:27.767","isDel":0,"isShowInfo":1};
    var SpecInfo = function (model) {
        var self = this;
        self.Cache = {};
        self.Id = ko.observable(model.Id);
        self.SpecId = ko.observable(model.SpecId);
        self.SpecName = ko.observable(model.SpecName);
        self.OriginalPrice = ko.observable(model.OriginalPrice);
        self.Price = ko.observable(model.Price);
        self.IsPriceOff = ko.observable(model.IsPriceOff);
        self.PriceOff = ko.observable(model.PriceOff);
        self.PriceOffTxt = ko.observable(model.PriceOff.towanyuan(2));
        self.IsEquipCar = ko.observable(model.EquipCarId>0?1:0);
        self.EquipCarId = ko.observable(model.EquipCarId);
        self.HasAllowance = ko.observable(model.HasAllowance);
        self.HasGiftPackage = ko.observable(model.HasGiftPackage);
        self.HasCoupon = ko.observable(model.HasCoupon);
        self.InventoryState = ko.observable(model.InventoryState);        
        self.InventoryColor = ko.observable(model.InventoryColor);
        self.PackageId = ko.observable(model.PackageId);
        self.GiftPackageCode = ko.observable(model.GiftPackageCode);
        self.SeriesId = ko.observable(model.SeriesId);
        self.Status = ko.observable(model.Status);
        self.IsDel = ko.observable(model.IsDel);
        self.FactorySubsidyPrice = ko.observable(model.FactorySubsidyPrice);
        self.FactorySubsidyPriceTxt=ko.observable(model.FactorySubsidyPrice.towanyuan(2));
        self.ExchangeSubsidyPrice = ko.observable(model.ExchangeSubsidyPrice);
        self.GovSubsidyPrice = ko.observable(model.GovSubsidyPrice);
        self.GovSubsidyPriceTxt=ko.observable(model.GovSubsidyPrice.towanyuan(2));
        self.AllowancePrice = ko.observable(model.AllowancePrice);
        self.AllowancePriceTxt=ko.observable(model.AllowancePrice.towanyuan(2));
        self.PurchaseTax = ko.observable(model.PurchaseTax);
        self.CompulsoryInsurance = ko.observable(model.CompulsoryInsurance);
        self.CommercialInsurance = ko.observable(model.CommercialInsurance);
        self.InsuranceDiscount = ko.observable(model.InsuranceDiscount);
        self.InsuranceDiscountValue=ko.observable(model.InsuranceDiscount.towanyuan(2));
        self.VehicleTaxPrice = ko.observable(model.VehicleTaxPrice);
        self.LicenseTaxPrice = ko.observable(model.LicenseTaxPrice);
        self.OtherPrice = ko.observable(model.OtherPrice);
        self.CompulsoryInsurancePrice = ko.observable(model.CompulsoryInsurancePrice);
        self.CommercialInsurancePrice = ko.observable(model.CommercialInsurancePrice);
        self.PurchaseTaxPrice = ko.observable(model.PurchaseTaxPrice);
        self.SpecDisplacement=ko.observable(model.SpecDisplacement);
        self.SpecStructureseat=ko.observable(model.SpecStructureseat);
        self.SpecIsImport=ko.observable(model.SpecIsImport);
        self.YearId = ko.observable(model.YearId);
        self.Colors = ko.observable();
        self.Cache.VehicleTaxPrice = -1;
        //计算列
        self.PurchaseTaxTxt = ko.computed(function () {
            if (self.PurchaseTax() == "50")
                return "购置税:赠送50%";
            if (self.PurchaseTax() == "100")
                return "购置税:赠送100%";
            return "不赠送购置税";
        }, self);
        self.CompulsoryInsuranceTxt = ko.computed(function () {
            if (self.CompulsoryInsurance() == "0")
                return "不赠送交强险";
            return "交强险:赠送" + self.CompulsoryInsurance() + "年";
        }, self);
        self.CommercialInsuranceTxt = ko.computed(function () {
            if (self.CommercialInsurance() == "0")
                return "不赠送商业险";
            return "商业险:赠送" + self.CommercialInsurance() + "年";
        }, self);
        self.InsuranceDiscountTxt = ko.computed(function () {
            if (self.InsuranceDiscount() == "0")
                return "无保险优惠";
            return "保险优惠:" + self.InsuranceDiscountValue() + "万元";
        }, self);
        self.CarPrice = ko.computed(function () {
            if (self.IsPriceOff() == 1) {
                self.Price(self.OriginalPrice() - self.PriceOff());
                return self.OriginalPrice() - self.PriceOff();
            } else {
                self.Price(self.OriginalPrice() + self.PriceOff());
                return self.OriginalPrice() + self.PriceOff();
            }
        }, self);
        self.GiftPackageCode = ko.computed(function() {
            for (var i = 0; i < viewmodel.Gifts().length; i++) {
                if (viewmodel.Gifts()[i].Id == self.PackageId())
                    return viewmodel.Gifts()[i].orderCode;
            }
            return '';
        });
        self.DealPrice = ko.computed(function () {
            CarPurchaseCostSpec(self);
            var dealPrice = Number(self.CarPrice()) + Number(self.PurchaseTaxPrice()) + Number(self.CompulsoryInsurancePrice()) + Number(self.CommercialInsurancePrice()) + Number(self.VehicleTaxPrice()) - Number(self.InsuranceDiscount()) + Number(self.LicenseTaxPrice()) + Number(self.OtherPrice());
            return dealPrice;
        }, self);
        //点击修改现金优惠按钮
        self.ModifyPriceOff = function (spec) {
            self.Cache.PriceOff = spec.PriceOff();
            self.Cache.FactorySubsidyPrice = spec.FactorySubsidyPrice();
            self.Cache.GovSubsidyPrice = spec.GovSubsidyPrice();
            self.Cache.AllowancePrice = spec.AllowancePrice();
            self.EditPriceOff(false);
        };
        self.SavePriceOff = function (spec) {            
            spec.PriceOffTxt(Number(spec.PriceOffTxt()).toFixed(2));
            spec.FactorySubsidyPriceTxt(Number(spec.FactorySubsidyPriceTxt()).toFixed(2));
            spec.GovSubsidyPriceTxt(Number(spec.GovSubsidyPriceTxt()).toFixed(2));
            spec.AllowancePriceTxt(Number(spec.AllowancePriceTxt()).toFixed(2));
            var priceOff = Number(spec.PriceOffTxt());
            var factoryPrice = Number(spec.FactorySubsidyPriceTxt());
            var govPrice = Number(spec.GovSubsidyPriceTxt());
            var allowanPrice = Number(spec.AllowancePriceTxt());
            if (Number(spec.PriceOffTxt()) * 10000 > self.OriginalPrice() * 0.35) {
                var content=
       '<div style="padding-left:20px;text-align: center;font-size: 14px;">现金优惠或加价不可以超出此车型指导价的35%（<span style="color:red;">'
           +  (self.OriginalPrice() * 0.35).towanyuan() + '万元</span>），请您重新填写！</div>';
                alert2(content, true);
                return false;
            }       

            if (priceOff < (factoryPrice + govPrice + allowanPrice)) {
                alert2("优惠或加价数值必须大于等于所有补贴之和！", true);
                return false;
            }
            spec.PriceOff(Math.round(priceOff * 10000));
            spec.FactorySubsidyPrice(Math.round(factoryPrice * 10000));
            spec.GovSubsidyPrice(Math.round(govPrice * 10000));
            spec.AllowancePrice(Math.round(allowanPrice * 10000));
            LoadRemoteTitle(1);
            spec.EditPriceOff(true);
        }
        self.RestorePriceOff = function (spec) {
            spec.PriceOff(self.Cache.PriceOff);
            spec.PriceOffTxt(self.Cache.PriceOff.towanyuan(2));
            spec.FactorySubsidyPrice(self.Cache.FactorySubsidyPrice);
            spec.FactorySubsidyPriceTxt(self.Cache.FactorySubsidyPrice.towanyuan(2));
            spec.GovSubsidyPrice(self.Cache.GovSubsidyPrice);
            spec.GovSubsidyPriceTxt(self.Cache.GovSubsidyPrice.towanyuan(2));
            spec.AllowancePrice(self.Cache.AllowancePrice);
            spec.AllowancePriceTxt(self.Cache.AllowancePrice.towanyuan(2));
            spec.EditPriceOff(true);
        }

        //点击修改保险按钮
        self.ModifyInsurance = function (spec) {
            self.Cache.PurchaseTax = spec.PurchaseTax();
            self.Cache.CompulsoryInsurance = spec.CompulsoryInsurance();
            self.Cache.CommercialInsurance = spec.CommercialInsurance();
            self.Cache.InsuranceDiscount = spec.InsuranceDiscount();
            self.Cache.InsuranceDiscountValue = spec.InsuranceDiscountValue();
            self.EditInsurance(false);
        }
        self.SaveInsurance = function (spec) {
            var insurancePrice = Number(spec.InsuranceDiscountValue()).toFixed(2) * 10000;
            if (insurancePrice > spec.OriginalPrice() * 0.15) {
                spec.InsuranceDiscount(self.Cache.InsuranceDiscount);
                alert2("店内保险优惠不能超过商业保险总额！");
                return false;
            }
            spec.InsuranceDiscount(Number(spec.InsuranceDiscountValue()) * 10000);
            self.EditInsurance(true);
        }
        self.RestoreInsurance = function (spec) {
            spec.PurchaseTax(self.Cache.PurchaseTax);
            spec.CompulsoryInsurance(self.Cache.CompulsoryInsurance);
            spec.CommercialInsurance(self.Cache.CommercialInsurance);
            spec.InsuranceDiscount(self.Cache.InsuranceDiscount);
            spec.InsuranceDiscountValue(self.Cache.InsuranceDiscountValue);
            self.EditInsurance(true);
        }

        //点击修改其它费用按钮
        self.ModifyOther = function (spec) {           
            self.Cache.VehicleTaxPrice = spec.VehicleTaxPrice();
            self.Cache.LicenseTaxPrice = spec.LicenseTaxPrice();
            self.Cache.OtherPrice = spec.OtherPrice();
            self.EditOther(false);
        }
        self.SaveOther = function (spec) {           
            self.EditOther(true);
        }
        self.RestoreOther = function (spec) {
            spec.VehicleTaxPrice(self.Cache.VehicleTaxPrice);
            spec.LicenseTaxPrice(self.Cache.LicenseTaxPrice);
            spec.OtherPrice(self.Cache.OtherPrice);
            self.EditOther(true);
        }

        //修改颜色
        self.ModifyColor = function (spec) {
            self.EditColor(false);
        }
        self.SaveColor = function (spec) {
            self.EditColor(true);
            var colors = '';
            var first = $("#" + spec.SpecId() + "color li input").first();
            if (first.is(":checked")) {
                colors = first.attr("colorname");
            }else
            {
                $("#" + spec.SpecId() + "color li input").each(function () {
                    if ($(this).is(":checked"))
                        colors += $(this).attr("colorname") + "、";
                });
                colors = colors.substring(0, colors.length - 1);
            }
            self.Colors(colors);
            self.InventoryColor(colors);
        }
        self.RestoreColor = function (spec) {
            self.EditColor(true);
        }

        //删除车型
        self.DeleteSpec = function (spec) {
            var num = 0;
            for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
                if (viewmodel.SpecInfos()[i].IsDel() == 0&&viewmodel.SpecInfos()[i].Status()==0)
                    num++;
            }
            if (num == 1) {
                mchalert("优惠车型至少应添加一个！");
                return false;
            }
            spec.IsDel(1);
            spec.Status(1);
            LoadRemoteTitle(1);
        }
        //一些状态码
        self.EditPriceOff = ko.observable(true);
        self.EditInsurance = ko.observable(true);
        self.EditOther = ko.observable(true);
        self.EditColor = ko.observable(true);
        self.Cache = function () { };
    }

    var NewsTemplateImage = function () {
        var self = this;
        self.Id = ko.observable();
        self.ImageId = ko.observable();
        self.ImageUrl = ko.observable();
        self.SmallImageUrl=ko.observable();
        self.ImageType = ko.observable();
        self.OrderId = ko.observable();
        self.IsDel = ko.observable();
        self.SelectPicture = function(img) {
            selectPicture(img.Id());
        };
    };

    var MaintainEngine = function () {
        var self = this;
        self.Id = ko.observable();
        self.DealerId = ko.observable();
        self.SeriesId = ko.observable();
        self.WarrantyYear = ko.observable();
        self.WarrantKm = ko.observable();
        self.DealerWarrantyKm = ko.observable();
        self.EngineOil = ko.observable();
        self.EngineOil3 = ko.observable();
        self.InsuranceCompany = ko.observable();
        self.InsurancePrice = ko.observable();
        self.FinanceCompany = ko.observable();
        self.LoanPayment = ko.observable();
        self.LoanMonth = ko.observable();
        self.LoanMonthPrice = ko.observable();
        self.CreateTime = ko.observable();
        self.LastTime = ko.observable();
        self.IsDel = ko.observable();
        self.IsShowInfo = ko.observable();
    }

    var Title = function () {
        var self = this;
        self.TitleText = ko.observable();
        self.TitleValue = ko.observable();
        self.DefaultSubTitle = ko.observable();
    }

    var Pacakge=function() {
        var self = this;
        self.Id=ko.observable();
        self.GiftCode=ko.observable();
        self.Content=ko.observable();
    }
    var Template = function () {
        var self = this;
        self.TemplateId = ko.observable();
        self.Integrity = ko.observable();
        self.IsPublish = ko.observable();
        self.NewsId = ko.observable();
        self.SeriesId = ko.observable();
        self.SeriesName = ko.observable();
        self.CompanyId=ko.observable($("#companyId").val());
        self.IsPriceOff = ko.observable();
        self.HasEquipCar = ko.observable();
        self.HasGiftPackage = ko.observable();
        self.PriceOff = ko.observable();
        self.LicensePrice = ko.observable();
        self.OtherPrice = ko.observable();
        self.FactorySubsidyPrice = ko.observable();
        self.ExchangeSubsidyPrice = ko.observable();
        self.GovSubsidyPrice = ko.observable();
        self.AllowancePrice = ko.observable();
        self.InventoryState = ko.observable();
        self.InsuranceDiscount = ko.observable();
        self.PurchaseTax = ko.observable();
        self.CompulsoryInsurance = ko.observable();
        self.CommercialInsurance = ko.observable();
        self.HasDealerInsurance = ko.observable();
        self.StartTime = ko.observable();
        self.EndTime = ko.observable();
        self.HasAddress = ko.observable();
        self.HasPhone = ko.observable();
        self.Address = ko.observable();
        self.Phone = ko.observable();
        self.IsHome = ko.observable();
        self.IsSubSite = ko.observable();
        self.IsBullet = ko.observable();
        self.IsFocus = ko.observable();
        self.Title = ko.observable();
        self.TitleId=ko.observable();
        self.SubTitle = ko.observable();
        self.IsCustomTitle = ko.observable();
        self.Content = ko.observable();
        self.Comment = ko.observable();
        self.Conclusion = ko.observable();
        self.FlagMaintain = ko.observable();
        self.OriginalHomeLastCount = ko.observable();
        self.OriginalSubLastCount = ko.observable();
        self.State = ko.observable();
        self.IsReCommend = ko.observable(0);
        self.SpecInfos = ko.observableArray([]);
        self.Titles = ko.observableArray([]);
        self.Packages=ko.observableArray([]);
        self.BigNewsTemplateImage = ko.observable(new NewsTemplateImage());
        self.BigImageTitle= ko.observable();
        self.NewsTemplateImages = ko.observableArray([new NewsTemplateImage()]);
        self.FocusImage=ko.observable(new NewsTemplateImage());
        self.MaintainEngines = ko.observableArray([]);
        self.SeriesColor = ko.observableArray(SeriesColor);
        self.DealerIds = ko.observable();
        self.PackAgeIds = ko.observable();
        self.EquipCarIds = ko.observable();
        self.EquipCars =  ko.observableArray([]);
        self.Gifts =  ko.observableArray([]);
        self.DealerList=ko.observableArray([]);
        self.EquptCarSpecIds=  ko.observableArray([]);
        self.IsAutoTemplate=ko.observable(0);
        self.IsAutoTitle=ko.observable(0);
        //加载车型的方法
        self.LoadSpecInfos = function (specs) {           
            var yearids = [];
            $(".specyear:checked").each(function() {
                if($(this).attr("used")=="true")
                yearids.push(Number($(this).attr("yearid")));
            });
            for (var i = 0; i < specs.length; i++) {
                var item = new SpecInfo(specs[i]);
                //更新对应的数据
                if(firstStepContentChanged)
                {
                    item.PriceOff(self.PriceOff());
                    item.PriceOffTxt(self.PriceOff().towanyuan(2));
                    item.Price(item.OriginalPrice() - self.PriceOff());
                    item.InventoryState(self.InventoryState());
                    item.ExchangeSubsidyPrice(self.ExchangeSubsidyPrice());
                    item.IsPriceOff(self.IsPriceOff());
                    item.LicenseTaxPrice(self.LicensePrice());
                    item.OtherPrice(self.OtherPrice());
                    item.FactorySubsidyPrice(self.FactorySubsidyPrice());
                    item.FactorySubsidyPriceTxt(self.FactorySubsidyPrice().towanyuan(2));
                    item.GovSubsidyPriceTxt(self.GovSubsidyPrice().towanyuan(2));
                    item.GovSubsidyPrice(self.GovSubsidyPrice());
                    item.AllowancePriceTxt(self.AllowancePrice().towanyuan(2));
                    item.AllowancePrice(self.AllowancePrice());
                    item.PurchaseTax(self.PurchaseTax());
                    item.CompulsoryInsurance(self.CompulsoryInsurance());
                    item.CommercialInsurance(self.CommercialInsurance());
                    item.InsuranceDiscount(self.InsuranceDiscount());                  
                    item.InsuranceDiscountValue(self.InsuranceDiscount().towanyuan(2));
                    item.Colors(item.InventoryColor());
                } else {
                    item.IsPriceOff(specs[i].IsPriceOff.toString());
                }

                if (yearids.indexOf(item.YearId())>-1  ||specs[i].EquipCarId>0) {
                    item.Status(0);
                }
                else {
                    item.Status(1);
                }

                item= CarPurchaseCostSpec(item);
                self.SpecInfos.push(item);
                if(item.InventoryColor()!=null)
                {
                    var first = $("#" + item.SpecId() + "color li input").first();
                    if (item.InventoryColor()=="颜色齐全") {
                        first.prop("checked", true);
                    }else
                    {
                        $("#" + item.SpecId() + "color li input").each(function () {
                            var name = $(this).attr("colorname");
                            if (item.InventoryColor().indexOf(name) > -1) {
                                $(this).prop("checked", true);
                            }
                        });
                    }
                }
            }
        }
        self.SaveAllData = function() {
            mchload('处理中…',200,50,'EF893L');
            SaveTemplate(1);
        }
        self.SaveDraft = function() {

            mchload('处理中…',200,50,'EF893L');
            SaveTemplate(0);
        }
        self.Preview=function() {
            if($("#WarrantyYear").val()>0&&$.trim($("#WarrantyKm").val())=='' || $("#WarrantyYear").val()==0&&$.trim($("#WarrantyKm").val())!='') {
                if($("#maincontrol").html() == "不使用")
                {
                    alert2("维修保养质保期年限和公里数必须同时填写！");
                    CloseAlert();
                    return false;
                }
            }
            //去掉不需要保存的车型
            for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
                var spec = viewmodel.SpecInfos()[i];
                if (spec.IsDel() == 1)
                    viewmodel.SpecInfos.remove(spec);
            }
            if($("#isAutoTitle").is(":checked"))
            {
                viewmodel.IsAutoTitle(1);
            } else {
                viewmodel.IsAutoTitle(0);
            }
            //商家Id
            viewmodel.DealerList(viewmodel.DealerIds().split(','));
            viewmodel.IsPublish(1);
            if (viewmodel.Title() == "") {
                viewmodel.Title(viewmodel.Titles()[0].TitleText());
            }
            //大图
            var bigimgId = "image" + viewmodel.BigNewsTemplateImage().Id();
            if ($("#" + bigimgId).attr("src") == '') {
                alert2("大图不能为空！");
                CloseAlert();
                return false;
            }

            //  优惠备注如果是默认      
            if ($("#comment").val() != "如优惠规则或礼包涵盖内容") {
                viewmodel.Comment($("#comment").val());
            } else {
                viewmodel.Comment('');
            }                

            //公司电话地址转换
            if (viewmodel.HasPhone() == true) {
                viewmodel.HasPhone(1);
            } else if (viewmodel.HasPhone() == false) {
                viewmodel.HasPhone(0);
            }
            if (viewmodel.HasAddress() == true) {
                viewmodel.HasAddress(1);
            } else if (viewmodel.HasAddress() == false) {
                viewmodel.HasAddress(0);
            }

            //是否必须在本地上保险
            viewmodel.HasDealerInsurance($("#chkHasDealerInsurance").is(":checked") ? 1 : 0);
            //维修保养数据压入
            PushMaintanceInfo();
            var json = encodeURIComponent(ko.toJSON(viewmodel));
            var url = "/Price/NewsTemplate/Preview";
            $.ajax({
                type: "POST",
                url: url + "?r=" + Math.random(),
                data: { "promotion": json },
                success: function(msg) {
                    if (msg) {
                        var url = "/Price/News/Preview";
                        url = url + "?title=" + encodeURIComponent(viewmodel.Title()) +"&seriesid="+viewmodel.SeriesId()+"&companyid="+$("#companyId").val()+ "&classid=2&rd="+Math.random();
                        $("#preview_url").attr("href", url);
                        document.getElementById("preview_url").click();
                    }
                },
                error: function () {

                }
            });
        }

        self.SelectPicture=function(model) {
            selectPicture(model.BigNewsTemplateImage().Id());
        }
        self.FocusSelectPicture=function(model) {
            selectPicture(model.FocusImage().Id());
        }
    };

    function SaveTemplate(state)  {
        //商家Id
        viewmodel.DealerList(viewmodel.DealerIds().split(','));
        if (viewmodel.Title() == "") {
            viewmodel.Title(viewmodel.Titles()[0].TitleText());
        }
        var dispalySpec = 0;
        for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
            if (viewmodel.SpecInfos()[i].Status() == 0)
                dispalySpec++;
        }
        //  优惠备注如果是默认
        if ($("#comment").val() != "如优惠规则或礼包涵盖内容") {
            viewmodel.Comment($("#comment").val());
        } else {
            viewmodel.Comment('');
        }

        //是否必须在本地上保险
        viewmodel.HasDealerInsurance($("#chkHasDealerInsurance").is(":checked") ? 1 : 0);
        if (dispalySpec == 0) {
            mchalert("抱歉！该车系下目前没有在售车型，请选择其它车系！");
            CloseAlert();
            return false;
        }
        if (state == 0 && $("#isAutoTitle").is(":checked")) {
            alert2("自定义标题不能保存草稿");
            CloseAlert();
            return false;
        }
        if($("#WarrantyYear").val()>0&&$.trim($("#WarrantyKm").val())=='' || $("#WarrantyYear").val()==0&&$.trim($("#WarrantyKm").val())!='') {
            if($("#maincontrol").html() == "不使用")
            {
                alert2("维修保养质保期年限和公里数必须同时填写！");
                CloseAlert();
                return false;
            }
        }       
        //标题长度判断
        if ( $("#isAutoTitle").is(":checked")&&!ValidateTitle()) {
            CloseAlert();
            return false;
        }
        //大图
        var bigimgId = "image" + viewmodel.BigNewsTemplateImage().Id();
        if ($("#" + bigimgId).attr("src") == '') {
            alert2("大图不能为空！");
            CloseAlert();
            return false;
        }
        //焦点图
        var focustId = "image" + viewmodel.FocusImage().Id();
        if ($("#" + focustId).attr("src") == '') {
            alert2("焦点图不能为空！");
            CloseAlert();
            return false;
        }
        viewmodel.IsPublish(state);
        if($("#isAutoTitle").is(":checked"))
        {
            viewmodel.IsAutoTitle(0);
            viewmodel.IsAutoTemplate(0);
            viewmodel.TitleId(0);
        } else {
            viewmodel.IsAutoTitle(1);
            viewmodel.TitleId($("#title").val());
        }
        //维修保养数据压入
        PushMaintanceInfo();
        //公司电话地址转换
        if (viewmodel.HasPhone() == true) {
            viewmodel.HasPhone(1);
        } else if (viewmodel.HasPhone() == false) {
            viewmodel.HasPhone(0);
        }
        if (viewmodel.HasAddress() == true) {
            viewmodel.HasAddress(1);
        } else if (viewmodel.HasAddress() == false) {
            viewmodel.HasAddress(0);
        }
        var json = encodeURIComponent(ko.toJSON(viewmodel));
        var url = "/Price/NewsTemplate/SaveNewsTemplateData";
        $.ajax({
            type: "POST",
            url: url + "?r=" + Math.random(),
            data: { "promotion": json },
            success: function(resultBag) {
                if (resultBag.ReturnCode == 0 || resultBag == 1) {
                    if (state == 1) {
                        window.location.href = "/Price/";
                    } else {
                        viewmodel.NewsId(resultBag.NewsId);
                        CloseAlert();
                    }
                } else {
                    CloseAlert();
                    mchalert(resultBag.ErrorMessage);
                }
            },
            error: function () {
                CloseAlert();
                alert2("文章发布失败，请联系相关顾问人员！");
            }
        });
    }

    function CloseAlert() {
        var dialog2 = dialog.get('EF893L');
        dialog2.close().remove();
    }

    function InitSecondSection(model) {
        viewmodel.PriceOff(Math.round(Number(model.PriceOff)*10000));
        viewmodel.NewsId(model.NewsId);
        viewmodel.TemplateId(model.TemplateId);
        viewmodel.SeriesId(model.Seriesid);
        viewmodel.SeriesName(model.SeriesName);
        viewmodel.Integrity(model.Integrity);
        viewmodel.IsPriceOff(model.IsPriceOff);
        viewmodel.LicensePrice(model.LicenseTaxPrice);
        viewmodel.OtherPrice(model.OtherPrice);
        viewmodel.FactorySubsidyPrice(Math.round(Number(model.FactorySubsidyPrice)*10000));
        viewmodel.ExchangeSubsidyPrice(model.ExchangeSubsidyPrice);
        viewmodel.GovSubsidyPrice(Math.round(Number(model.GovSubsidyPrice)*10000));
        viewmodel.AllowancePrice(Math.round(Number(model.AllowancePrice)*10000));
        viewmodel.HasGiftPackage(model.HasGiftPackage ? 1 : 0);
        viewmodel.HasEquipCar(model.HasEquipCar ? 1 : 0);
        viewmodel.InventoryState(model.InventoryState);
        viewmodel.PurchaseTax(model.PurchaseTax);
        viewmodel.CompulsoryInsurance(model.CompulsoryInsurance);
        viewmodel.CommercialInsurance(model.CommercialInsurance);
        viewmodel.InsuranceDiscount(Math.round(Number(model.InsuranceDiscount)*10000));
        viewmodel.HasDealerInsurance(model.HasDealerInsurance);
        viewmodel.StartTime(model.StartDate);
        viewmodel.EndTime(model.EndDate);
        viewmodel.IsReCommend(model.IsRecommend?1:0);
        viewmodel.IsBullet(model.IsBullet?1:0);
        viewmodel.IsFocus(model.IsFocus?1:0);
        viewmodel.DealerIds(model.DealerIds);
        viewmodel.PackAgeIds(model.PackAgeIds);
        viewmodel.EquipCarIds(model.EquipCarIds);
        viewmodel.Title(news_titie);
        viewmodel.SubTitle(news_sub_titie);
        viewmodel.IsAutoTitle(news_IsAutoTitle);
        viewmodel.IsAutoTemplate(news_IsAutoTemplate);
        viewmodel.HasPhone(news_hasphone);
        viewmodel.HasAddress(news_hasaddress);
        if (news_content != "") {
            viewmodel.Content(news_content);
        } else {
            viewmodel.Content(buildContent());
        }
        if (news_comment != "") {
            viewmodel.Comment(news_comment);
            $("#comment").val(news_comment);
            $(".informationissuepic-textarea").css("color","black");
        } else {
            $("#comment").val("如优惠规则或礼包涵盖内容");
            $(".informationissuepic-textarea").css("color","#999");
        }
        if (news_conclusion != "") {
            viewmodel.Conclusion(news_conclusion);

        } else {
            {
                viewmodel.Conclusion("以上为车型资料信息，本店提供了很多附加增值性服务，感兴趣的朋友欢迎咨询本店资讯详细信息。");
            }
        }

        if (model.NewsId == 0) {
            viewmodel.HasAddress(true);
            viewmodel.HasPhone(true);
        }
        if (model.EquipCarJson != "") {
            viewmodel.EquipCars(eval('(' + model.EquipCarJson + ')'));
            viewmodel.HasEquipCar(1);
        }        
        if (model.PackageJson != "") {
            viewmodel.Gifts(eval('(' + model.PackageJson + ')'));
            viewmodel.HasGiftPackage(1);
        }
        if (viewmodel.EquipCars()) {
            for (var i = 0; i <viewmodel.EquipCars().length;i++ ) {
                viewmodel.EquptCarSpecIds.push(viewmodel.EquipCars()[i].SpecId);
            }
        }
        //是否隐藏保存草稿按钮
        if (news_isPublish == "1") {
            $("#draftbtn").hide();
        }
        GetOnSaleYearIds();
        LoadRemoteData();
        LoadRemoteTitle(0);
        //图片初始化
        BindPics();
        //初始化维修保养
        var maintainEngine = new MaintainEngine();
        if (MaintainEngineJson.hasOwnProperty("id")) {
            maintainEngine.Id(MaintainEngineJson.id);
            maintainEngine.DealerId(MaintainEngineJson.companyId);
            maintainEngine.SeriesId(MaintainEngineJson.seriesId);
            maintainEngine.WarrantyYear(MaintainEngineJson.warrantyYear);
            maintainEngine.WarrantKm(MaintainEngineJson.warrantyKm==-1?'':MaintainEngineJson.warrantyKm);
            maintainEngine.DealerWarrantyKm(MaintainEngineJson.dealerWarrantyKm==0?'':MaintainEngineJson.dealerWarrantyKm);
            maintainEngine.EngineOil(MaintainEngineJson.engineOil==-1?'':MaintainEngineJson.engineOil);
            maintainEngine.EngineOil3(MaintainEngineJson.engineOil3==-1?'':MaintainEngineJson.engineOil3);
            maintainEngine.InsuranceCompany(MaintainEngineJson.insuranceCompany);
            maintainEngine.InsurancePrice(MaintainEngineJson.insurancePrice==0?'':MaintainEngineJson.insurancePrice);
            maintainEngine.FinanceCompany(MaintainEngineJson.financeCompany);
            maintainEngine.LoanPayment(MaintainEngineJson.loanPayment==0?'':MaintainEngineJson.loanPayment);
            maintainEngine.LoanMonth(MaintainEngineJson.loanMonth==0?'':MaintainEngineJson.loanMonth);
            maintainEngine.LoanMonthPrice(MaintainEngineJson.loanMonthPrice==0?'':MaintainEngineJson.loanMonthPrice);
            maintainEngine.CreateTime(MaintainEngineJson.createTime);
            maintainEngine.LastTime(MaintainEngineJson.lastTime);
            maintainEngine.IsDel(0);

        }

        viewmodel.MaintainEngines.push(maintainEngine);
        //$(#title)
        $("#title").bind("change", function () {
            viewmodel.Title($("#title :selected").text());
            var array = viewmodel.Titles();
            for (var j = 0; j < array.length; j++) {
                if (viewmodel.Title() == viewmodel.Titles()[j].TitleText()) {
                    viewmodel.SubTitle(viewmodel.Titles()[j].DefaultSubTitle());
                }
            }
        });

        $(".wanyuan").bind('keypress', function(eve) {
            if ((eve.which != 46 || $(this).val().indexOf('.') != -1) && (eve.which < 48 || eve.which > 57) || (eve.which == 46 && $(this).caret().start == 0)) {                               
                eve.preventDefault();
            }
            
            priceKeyPress(this, 0);
        });      
         
        $('.intNum').bind('keypress', function (eve) {        
            var num = $(this).val();            
            var pr = num.replace(/[^\d]/g, "");
            $(this).val(pr.replace('.', ''));
        });
        $('.intNum').bind('blur',function() {
            $(this).val($(this).val().replace('.', ''));
        });

        $("#isAutoTitle").bind("click", function() {
            //判断自定义标题是否可用
            if (viewmodel.IsReCommend() == 0&&$(this).is(":checked")) {
                alert2("非推荐的文章不能自定义标题");
                return false;
            }
            if ($("#chk_isRecommend").attr("customlastcount") < 1&&$(this).is(":checked")) {
                alert2("您的自定义名额已用完，不能再自定义标题");
                return false;
            }
            if ($(this).is(":checked")) {
                $("#title").hide();
                $("#txtTitle").css("display","inline-block");
                $("#subTitle").removeAttr("disabled");
            } else {
                $("#title").show();
                $("#txtTitle").hide();
                //viewmodel.Title($("#title :selected").text());
                $("#title").trigger("change");//触发长标题change事件
                $("#subTitle").attr("disabled", "disabled");
            }
        });
        $("input:radio[name='DealerWarrantyKm']").bind("click", function() {
            if ($(this).val() == 0) {
                $("#DealerWarrantyKm4value").attr("disabled", false);
            } else {
                $("#DealerWarrantyKm4value").attr("disabled", true);
            }
        });

        bindSpecListEvent();
        if(MaintainEngineJson.hasOwnProperty("warrantyKm"))
            bindMaintanceInfo();
    }

    function LoadRemoteData() {
        var eqids = viewmodel.EquipCarIds();
        var dealerids = viewmodel.DealerIds();
        var seriesId = viewmodel.SeriesId();
        var newstemplateid = viewmodel.TemplateId();
        var url = "/Price/NewsTemplate/GetSpecsList";
        $.ajax({
            type: "POST",
            url: url + "?r=" + Math.random(),
            data: {"eqids":eqids,"dealerids":dealerids,"seriesId":seriesId,"newstemplateid":newstemplateid},
            async: false,
            beforeSend: function () {
                //mchload('数据加载中...');
            },
            success: function (msg) {
               // closeDialog();
                viewmodel.SpecInfos.removeAll();
                viewmodel.LoadSpecInfos(msg);
            },
            complete:function() {
             //   closeDialog();
            },
            error: function () {

           }
        });
        bindSpecListEvent();
    }

    function GetOnSaleYearIds() {
        var dealerids = viewmodel.DealerIds();
        var seriesId = viewmodel.SeriesId();
        var url = "/Price/NewsTemplate/GetSpecYearsOnSale";
        $.ajax({
            type: "POST",
            url: url + "?r=" + Math.random(),
            data: {"dealerids":dealerids,"seriesId":seriesId},
            async: false,
            beforeSend: function () {
                //mchload('数据加载中...');
            },
            success: function (msg) {
                $(".specyear[yearid='" + msg[0] + "']").prop("checked", true);
                for (var i = 0; i < msg.length; i++) {
                    $(".specyear[yearid='" + msg[i] + "']").parent().show();
                    $(".specyear[yearid='" + msg[i] + "']").attr("used", true);
                }
            },
            complete:function() {
                //   closeDialog();
            },
            error: function () {

            }
        });
    }

    function ResetSpecData() {
        mchconfirm("是否确定重新加载全部车型？加载后表格刷新为生成表格时的样式。", 210, 50, function() {
            var eqids = viewmodel.EquipCarIds();
            var dealerids = viewmodel.DealerIds();
            var seriesId = viewmodel.SeriesId();
            var newstemplateid = 0;
            var url = "/Price/NewsTemplate/GetSpecsList";
            $.ajax({
                type: "POST",
                url: url + "?r=" + Math.random(),
                data: {"eqids":eqids,"dealerids":dealerids,"seriesId":seriesId,"newstemplateid":newstemplateid},
                async: false,
                beforeSend: function () {
                    //mchload('数据加载中...');
                },
                success: function (msg) {
                    // closeDialog();
                    firstStepContentChanged = true;
                    viewmodel.SpecInfos.removeAll();
                    viewmodel.LoadSpecInfos(msg);
                },
                complete:function() {
                    //   closeDialog();
                },
                error: function () {

                }
            });
            bindSpecListEvent();
            LoadRemoteTitle(1);
        });
    }
    function LoadRemoteTitle(type) {
        //获取标题
        var url = "/Price/NewsTemplate/GetTemplateTitle";
        var priceOff=0;
        var price = 0;      
        var recommend = 0;
        var dealerIds = viewmodel.DealerIds().split(",");     
        for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
            if (viewmodel.SpecInfos()[i].PriceOff() > priceOff &&viewmodel.SpecInfos()[i].Status()==0&&viewmodel.SpecInfos()[i].IsPriceOff()==viewmodel.IsPriceOff()&&viewmodel.SpecInfos()[i].IsDel()==0)
                priceOff = viewmodel.SpecInfos()[i].PriceOff();
            if (viewmodel.SpecInfos()[i].Status()==0&&viewmodel.SpecInfos()[i].IsDel()==0)
            {
                if (price == 0||(price != 0&&price>viewmodel.SpecInfos()[i].CarPrice())) {
                    price = viewmodel.SpecInfos()[i].CarPrice();
                }                 
            }
        }
        //if (viewmodel.PriceOff() == 0)
        //    priceOff = 0;
        if (price == 0)
            return false;
        if (viewmodel.IsReCommend() == 1)
            recommend = 1;
        $.ajax({
            type: "POST",
            url: url + "?r=" + Math.random(),
            async: false,
            data: { "action": 0, "seriesid": viewmodel.SeriesId(), "packageId": viewmodel.HasGiftPackage(), "priceOff":priceOff, "isPriceOff": viewmodel.IsPriceOff(), "inventoryState": viewmodel.InventoryState(), "isRecommend": recommend, "price": price, "checkRepeate": recommend,"DealerIds":dealerIds },
            beforeSend: function () {
                //    mchload('数据加载中...');
            },
            success: function (titles) {
                viewmodel.Titles.removeAll();
                if(type==0)
                {
                    if (news_IsAutoTitle == 0) {
                        $("#isAutoTitle").prop("checked",true);
                        $("#title").hide();
                        $("#txtTitle").val(news_titie);
                        $("#subTitle").removeAttr("disabled");
                        viewmodel.SubTitle(news_sub_titie );
                        viewmodel.Title(news_titie);
                    } else {
                        $("#txtTitle").val(titles[0].Title);
                        $("#isAutoTitle").prop("checked",false);
                        $("#txtTitle").hide();
                        viewmodel.SubTitle(titles[0].DefaultSubTitle);
                        viewmodel.Title(titles[0].Title);
                    }
                }
                for (var i = 0; i < titles.length; i++) {
                    var title = new Title();
                    title.TitleValue(titles[i].Id);
                    title.TitleText(titles[i].Title);
                    title.DefaultSubTitle(titles[i].DefaultSubTitle);
                    viewmodel.Titles.push(title);
                }
            },
            complete:function() {
                //   closeDialog();
            },
            error: function () {

            }
        });
    }
    function BindPics() {
        //设置图片Pics
        var pic={};
        pic.smallPics = [];
        var hasPic = false;
        for (var i = 0; i < Pics.length; i++) {
            if (Pics[i].yearId == $("#yearid").val()&&Pics[i].smallPics.length>0) {
                pic = Pics[i];
                hasPic = true;
            }
        }

        //1设置大图
        var bigImage = new NewsTemplateImage();
        if (BigPicJson != null) {
            bigImage.Id(BigPicJson.id);
            bigImage.ImageId(BigPicJson.imageId);
            bigImage.ImageUrl (BigPicJson.imageUrl);
            bigImage.SmallImageUrl(GetSmallImageUrl(BigPicJson.imageUrl));
            bigImage.ImageType(BigPicJson.imageType);
            bigImage.OrderId(BigPicJson.orderId);
            bigImage.IsDel(0);
            viewmodel.BigImageTitle(news_bigimagetitle);
        }
        else  if (hasPic&&pic.hasOwnProperty("bigPic")) {
            bigImage.Id(pic.bigPic.id);
            bigImage.ImageId(pic.bigPic.picid);
            bigImage.ImageUrl(pic.bigPic.picfilepath);
            bigImage.SmallImageUrl(GetSmallImageUrl(pic.bigPic.picfilepath));
            bigImage.ImageType(pic.bigPic.imageType);
            bigImage.OrderId(1);
            bigImage.IsDel(0);
            viewmodel.BigImageTitle(pic.bigPic.specname);
        } else {
            bigImage.Id(1);
            bigImage.ImageId(1);
            bigImage.ImageUrl('');
            bigImage.SmallImageUrl('');
            bigImage.ImageType(1);
            bigImage.OrderId(1);
            bigImage.IsDel(0);
        }
        viewmodel.BigNewsTemplateImage(bigImage);
        //焦点图focusPicJson

        var focusImage = new NewsTemplateImage();
        if (FocusPicJson != null) {
            focusImage.Id(FocusPicJson.id);
            focusImage.ImageId(FocusPicJson.imageId);
            focusImage.ImageUrl (FocusPicJson.imageUrl);
            focusImage.SmallImageUrl(GetSmallImageUrl(FocusPicJson.imageUrl));
            focusImage.ImageType(FocusPicJson.imageType);
            focusImage.OrderId(FocusPicJson.orderId);
            focusImage.IsDel(0);
        }
        else  if (hasPic&&pic.hasOwnProperty("bigPic")) {
            focusImage.Id(2);
            focusImage.ImageId(pic.bigPic.picid);
            focusImage.ImageUrl(pic.bigPic.picfilepath);
            focusImage.SmallImageUrl(GetSmallImageUrl(pic.bigPic.picfilepath));
            focusImage.ImageType(pic.bigPic.imageType);
            focusImage.OrderId(1);
            focusImage.IsDel(0);
        } else {
            focusImage.Id(2);
            focusImage.ImageId(1);
            focusImage.ImageUrl('');
            focusImage.SmallImageUrl('');
            focusImage.ImageType(2);
            focusImage.OrderId(1);
            focusImage.IsDel(0);
        }
        viewmodel.FocusImage(focusImage);
        var smallPicArray=[];
        var index = 0;
        if (SmallPicJson.length != 0) {
            smallPicArray = SmallPicJson;
        } else if(hasPic){
            smallPicArray = pic.smallPics;
        }

        viewmodel.NewsTemplateImages.removeAll();

        for (var i = 0; i < smallPicArray.length; i++) {
            var smallImage = new NewsTemplateImage();
            smallImage.Id(smallPicArray[i].id);

            if (smallPicArray[i].hasOwnProperty('picfilepath')) {
                smallImage.ImageUrl(smallPicArray[i].picfilepath);
                smallImage.SmallImageUrl(GetSmallImageUrl(smallPicArray[i].picfilepath));
                smallImage.ImageId(smallPicArray[i].picid);
            } else {
                smallImage.ImageUrl(smallPicArray[i].imageUrl);
                smallImage.SmallImageUrl(GetSmallImageUrl(smallPicArray[i].imageUrl));
                smallImage.ImageId(smallPicArray[i].imageId);
            }
            smallImage.ImageType(0);
            smallImage.OrderId(2 + i);
            smallImage.IsDel(0);
            viewmodel.NewsTemplateImages.push(smallImage);
            index++;
        }
        //如果没有图片，填满空的图片
        for (var i = index; i < 4; i++) {
            var smallImage = new NewsTemplateImage();
            smallImage.Id(11+i);
            smallImage.ImageId(0);
            smallImage.ImageUrl('');
            smallImage.SmallImageUrl('');
            smallImage.ImageType(0);
            smallImage.OrderId(2 + i);
            smallImage.IsDel(0);
            viewmodel.NewsTemplateImages.push(smallImage);
        }
    }
    function CarPurchaseCostSpec(spec) {
        var carPurchaseCost = new CarPurchaseCost(); //计算器类初始化
        carPurchaseCost.carCostParam.carPrice = spec.Price();
        carPurchaseCost.carCostParam.displacement =  spec.SpecDisplacement();
        carPurchaseCost.carCostParam.seatCount = spec.SpecStructureseat();
        carPurchaseCost.carCostParam.isImport = spec.SpecIsImport() == "国产" ? 0 : 1;

        //开始计算
        if (spec.CommercialInsurance() == 0) {
            var result = carPurchaseCost.getThirdInsurance() + carPurchaseCost.getDamageInsurance() + carPurchaseCost.getStolenInsurance() + carPurchaseCost.getGlassInsurance() + carPurchaseCost.getCombustInsurance() + carPurchaseCost.getNoDeductibleInsurance() + carPurchaseCost.getNoLiabilityInsurance() + carPurchaseCost.getPassengerInsurance() + carPurchaseCost.getCarBodyInsurance();
            spec.CommercialInsurancePrice(Math.round(result));
        } else {
            spec.CommercialInsurancePrice(0);
        }
        if (spec.CompulsoryInsurance() == 0) {
            spec.CompulsoryInsurancePrice(carPurchaseCost.getTrafficInsurance());
        } else {
            spec.CompulsoryInsurancePrice(0);
        }
        if (spec.PurchaseTax() == 0) {
            spec.PurchaseTaxPrice(Math.round(getpurchaseTaxPrice(spec.OriginalPrice())));
        } else if (spec.PurchaseTax() == 50) {
            spec.PurchaseTaxPrice(Math.round(getpurchaseTaxPrice(spec.OriginalPrice()) * 0.5));
        } else {
            spec.PurchaseTaxPrice(0);
        }
        if(spec.Cache.VehicleTaxPrice==-1)
            spec.VehicleTaxPrice(carPurchaseCost.getUsageTax());//车船税
        return spec;
    }
    //上传图片
    function selectPicture(imagetype) {
        var seriesid = viewmodel.SeriesId();//车系id
        dialogPic.init(1, imagetype, seriesid);
    }
    //图片选择回调函数
    //imgid:图片id
    //imgurl:图片路径
    //imgType:从调用页面传递的参数
    //imgTitle:图片标题
    //imgState:图片审核状态 1=已通过（产品库的图片默认通过），2=未审核
    function changePicture(imgId, imgUrl, imgType, imgTitle, imgState) {
        viewmodel.IsAutoTemplate(1);
        if (imgState == 2)
            viewmodel.IsAutoTemplate(0);
        if (imgUrl != '') {
            var imagesrc = formatImageUrl(imgUrl);
            if (viewmodel.BigNewsTemplateImage().Id() == imgType) {
                viewmodel.BigNewsTemplateImage().ImageUrl(imagesrc);
                viewmodel.BigNewsTemplateImage().SmallImageUrl(GetSmallImageUrl(imagesrc));
                viewmodel.BigNewsTemplateImage().IsDel(imgState);
                viewmodel.BigNewsTemplateImage().ImageId(imgId);
            } else if (viewmodel.FocusImage().Id() == imgType) {
                viewmodel.FocusImage().ImageUrl(imagesrc);
                viewmodel.FocusImage().SmallImageUrl(GetSmallImageUrl(imagesrc));
                viewmodel.FocusImage().ImageId(imgId);
                viewmodel.FocusImage().IsDel(imgState);
            }else
            {
                // $("#image" + imgType).attr("src", imgUrl);
                for (var i = 0; i < viewmodel.NewsTemplateImages().length; i++) {
                    if (viewmodel.NewsTemplateImages()[i].Id() == imgType) {
                        viewmodel.NewsTemplateImages()[i].ImageId(imgId);
                        viewmodel.NewsTemplateImages()[i].ImageUrl(imagesrc);
                        viewmodel.NewsTemplateImages()[i].SmallImageUrl(GetSmallImageUrl(imagesrc));
                        viewmodel.NewsTemplateImages()[i].IsDel(imgState);
                    }
                }
            }
        }
    }
    function formatImageUrl(url) {
        if (url) {
            return url.replace('/u_', '/s_');
        }
        return '';
    }
  
    function changeMaintan() {
        var self = $("#maincontrol");
        var isShow = self.attr("isShow");
        if (isShow==0) {
            $("#matainceInfo").hide();
            self.attr("isShow",1);
            self.html("使用");
        } else {
            $("#matainceInfo").show();
            self.attr("isShow",0);
            self.html("不使用");
        }
        // 及时调整资料完整度
        viewmodel.MaintainEngines()[0].IsShowInfo(isShow);
        integrityShow();
    }
    function getpurchaseTaxPrice(price) {
        return (price / 1.17) * 0.1;
    }
    function buildContent() {
        var title = "";
        var content = '';
        if (viewmodel.HasEquipCar()==1) {
            if (viewmodel.PriceOff() > 0) {
                if (viewmodel.IsPriceOff() == 1) {
                    title = viewmodel.SeriesName() + viewmodel.InventoryState() + ' 加装车最高优惠' + viewmodel.PriceOff().towanyuan() + "万元";
                    content = "近日，本店内" + viewmodel.SeriesName() + "现车销售，颜色可选，目前购车部分加装车型可优惠" + viewmodel.PriceOff().towanyuan() + "万元，感兴趣的朋友可以到店咨询购买，详情见下表：";
                }
                else if (viewmodel.IsPriceOff() == 0) {
                    title = viewmodel.SeriesName() + viewmodel.InventoryState() + ' 加装车最低加价' +  viewmodel.PriceOff().towanyuan() + "万元";
                    content =  "近日，本店内"  +  viewmodel.SeriesName() + "现车销售，颜色可选，目前购车部分加装车型加价" + viewmodel.PriceOff().towanyuan() + "万元，感兴趣的朋友可以到店咨询购买，详情见下表：";
                }
            }
            else {
                title = viewmodel.SeriesName() + viewmodel.InventoryState();
                content = "近日，本店内" + viewmodel.SeriesName()  + "现车销售，颜色可选，感兴趣的朋友可以到店咨询购买，详情见下表：";
            }
        }
        else {
            if (viewmodel.PriceOff()> 0) {
                if (viewmodel.IsPriceOff()  == 1) {
                    title = viewmodel.SeriesName() + viewmodel.InventoryState()+ ' 最高优惠' + viewmodel.PriceOff().towanyuan() + "万元";
                    content = "近日，本店内" + viewmodel.SeriesName() + "现车销售，颜色可选，目前购车部分车型可优惠" + viewmodel.PriceOff().towanyuan() + "万元，感兴趣的朋友可以到店咨询购买，详情见下表：";
                }
                else if (viewmodel.IsPriceOff() == 0) {
                    title = viewmodel.SeriesName() + viewmodel.InventoryState()+ ' 最低加价' + viewmodel.PriceOff().towanyuan()  + "万元";
                    content = "近日，本店内"  + viewmodel.SeriesName() + "现车销售，颜色可选，目前购车部分车型加价" + viewmodel.PriceOff().towanyuan()+ "万元，感兴趣的朋友可以到店咨询购买，详情见下表：";
                }
            }
            else {
                title =  viewmodel.SeriesName() + viewmodel.InventoryState() ;
                content =  "近日，本店内" + viewmodel.SeriesName() + "现车销售，颜色可选，感兴趣的朋友可以到店咨询购买，详情见下表";
            }
        }
        return content;;
    }
    function bindSpecListEvent() {
        $(".specyear").unbind("click").bind("click", function () {
            viewmodel.IsAutoTemplate(1);
            var yearid = $(this).attr("yearid");
            var maxyearid = $("#yearid").attr("maxyearid");
            var state = 1;
            if ($(this).is(":checked"))
                state = 0;
            if ($(".specyear").length == $(".specyear:checked").length) {
                $(".specyearall").prop("checked", true);
            } else {
                $(".specyearall").prop("checked", false);
            }
            for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
                if (viewmodel.SpecInfos()[i].YearId() == yearid&&viewmodel.SpecInfos()[i].EquipCarId()==0) {
                    viewmodel.SpecInfos()[i].Status(state);
                }
            }
            yearid = 0;
            $(".specyear:checked").each(function() {
                yearid < $(this).attr("yearid") ? yearid = $(this).attr("yearid") : yearid=yearid;
            });
            $("#yearid").val(yearid);
            BindPics();
            LoadRemoteTitle(1);
        });
        $(".specyearall").unbind("click").bind("click", function () {
            viewmodel.IsAutoTemplate(1);
            var state = false;
            var isdel = 1;
            if ($(this).is(":checked")) {
                state = true;
                isdel = 0;
            }
            $(".specyear").prop("checked", state);
            for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
                if(viewmodel.SpecInfos()[i].IsDel()==0&&viewmodel.SpecInfos()[i].EquipCarId()==0)
                    viewmodel.SpecInfos()[i].Status(isdel);
            }
            var yearid=$("#yearid").attr("maxyearid");
            $("#yearid").val(yearid);
            BindPics();
            LoadRemoteTitle(1);
        });
        $("#showSpec").bind("click", function () {
            for (var i = 0; i < viewmodel.SpecInfos().length; i++) {
                if (viewmodel.SpecInfos()[i].IsDel() == 1) {
                    viewmodel.SpecInfos()[i].IsDel(0);
                    viewmodel.SpecInfos()[i].Status(0);
                }
            }
            LoadRemoteTitle(1);
        });
        $(".specColor[id='1']").bind("click", function() {

            var parent = $(this).closest("ul");
            if ($(this).is(":checked")) {
                parent.find("input").prop("checked", true);
            } else {
                parent.find("input").prop("checked", false);
            }
        });
    }
    //维修保养信息的显示或隐藏
    function bindMaintanceInfo() {
        if (MaintainEngineJson.engineOil>=0) {
            $("#EngineOil").val(MaintainEngineJson.engineOil);
        }
        if (MaintainEngineJson.engineOil3>=0) {
            $("#EngineOil3").val(MaintainEngineJson.engineOil3);
        }
        if (MaintainEngineJson.warrantyKm>=0) {
            $("#WarrantyKm").val(MaintainEngineJson.warrantyKm);
        }
        $(".insuranceCompany").each(function() {
            if (MaintainEngineJson.insuranceCompany.indexOf($(this).attr("name")) > -1)
                $(this).prop("checked", true);
        });
        if (MaintainEngineJson.isShowInfo == 0) {
            $("#matainceInfo").hide();
            $("#maincontrol").attr("isShow",1);
            $("#maincontrol").html("使用");
        } else {
            $("#matainceInfo").show();
            $("#maincontrol").attr("isShow",0);
            $("#maincontrol").html("不使用");
        }
        if (MaintainEngineJson.dealerWarrantyKm == "5000" || MaintainEngineJson.dealerWarrantyKm == "7500" || MaintainEngineJson.dealerWarrantyKm == "10000") {
            $("input[name=DealerWarrantyKm][value=" + MaintainEngineJson.dealerWarrantyKm + "]").prop("checked", true);
        } else {
            $("input[name=DealerWarrantyKm][value=0]").prop("checked", true);
            $("#DealerWarrantyKm4value").val(MaintainEngineJson.dealerWarrantyKm);
        }
        $("#DealerWarrantyKm4value").bind("focus", function() {
            //选中其它按钮
            $("input[name=DealerWarrantyKm][value=0]").prop("checked",true);
        });
    }
    function ValidateTitle() {      
        var subjectLength;
        if ($("#isAutoTitle").is(":checked")) {
            var title = $("#txtTitle").val();
            var subTitle= $("#subTitle").val();
            subjectLength = title.replace(/(^\s*)|(\s*$)/g, '').strlength();
            var subtitleLength= subTitle.replace(/(^\s*)|(\s*$)/g, '').strlength();
            if (title == '') {
                alert2('请填写文章标题！');
                return false;
            }
            if (subTitle == '') {
                alert2('请填写文章短标题！');
                return false;
            }

            if (subjectLength < 33 || subjectLength > 36) {
                alert2("文章标题必须在16-18字范围内！");
                return false;
            }
            if (subtitleLength < 19 || subtitleLength > 22) {
                alert2("文章短标题必须在9.5-11字范围内！");
                return false;
            }
            if (checkNum(title)) {
                alert2("文章标题不能出现七位以上连续阿拉伯数字！");
                return false;
            }
            if (checkNum(subTitle)) {
                alert2("文章短标题不能出现七位以上连续阿拉伯数字！");
                return false;
            }
            if (!signTest(title)) {
                alert2("标题中禁止连续重复使用同一标点！");
                return false;
            }
            if (!signTest(subTitle)) {
                alert2("短标题中禁止连续重复使用同一标点！");
                return false;
            }
            var res = titleTest(title);
            if (res != "") {
                alert2("标题中禁止出现" + res + "字样！");
                return false;
            }
            res = titleTest(subTitle);
            if (res != "") {
                alert2("短标题中禁止出现" + res + "字样！");
                return false;
            }
            if (changeSignTest(title)||changeSignTest(subTitle)) {
                alert2("请不要使用" + TitleForbiddenSigns + "标点！");
                return false;
            }
        } else {
            subjectLength = $("#title :selected").text().replace(/(^\s*)|(\s*$)/g, '').strlength();
            if (subjectLength > 40) {
                alert2('因您的车系名称导致长标题过长会影响前台页面显示，请您联系相关顾问人员！');
                return false;
            }
            if (subjectLength < 20) {
                alert2('长标题过短会影响前台页面显示，请您联系相关顾问人员！');
                return false;
            }
        }
        return true;
    }
    function PushMaintanceInfo() {
        //维修保养数据压入
        if ($("#maincontrol").html() == "不使用")
            viewmodel.MaintainEngines()[0].IsShowInfo(1);
        else
            viewmodel.MaintainEngines()[0].IsShowInfo(0);
        var dealerkm = $("input[name=DealerWarrantyKm]:checked").val();
        if (dealerkm == 0)
            dealerkm = $("#DealerWarrantyKm4value").val();
        viewmodel.MaintainEngines()[0].DealerWarrantyKm(dealerkm);
        var insuranceCompany="";
        $(".insuranceCompany:checked").each(function() {
            insuranceCompany = insuranceCompany + $(this).attr("name") + " ";
        });
        viewmodel.MaintainEngines()[0].InsuranceCompany(insuranceCompany);

        //三个字段为空则==-1的逻辑
        if ($.trim($("#WarrantyKm").val()) == '') {
            viewmodel.MaintainEngines()[0].WarrantKm(-1);
        } else {
            viewmodel.MaintainEngines()[0].WarrantKm($.trim($("#WarrantyKm").val()));
        }
        if ($.trim($("#EngineOil").val()) == '') {
            viewmodel.MaintainEngines()[0].EngineOil(-1);
        } else {
            viewmodel.MaintainEngines()[0].EngineOil($.trim($("#EngineOil").val()));
        }
        if ($.trim($("#EngineOil3").val()) == '') {
            viewmodel.MaintainEngines()[0].EngineOil3(-1);
        } else {
            viewmodel.MaintainEngines()[0].EngineOil3($.trim($("#EngineOil3").val()));
        }

        //计算文章完整度
        //if (viewmodel.MaintainEngines()[0].InsurancePrice() > 0)
        //    viewmodel.Integrity(Number(viewmodel.Integrity()) + 10);
        //if (viewmodel.MaintainEngines()[0].LoanPayment() > 0||viewmodel.MaintainEngines()[0].LoanMonthPrice()>0)
        //    viewmodel.Integrity(Number(viewmodel.Integrity()) + 10);
        //if (viewmodel.MaintainEngines()[0].DealerWarrantyKm() > 0||viewmodel.MaintainEngines()[0].WarrantKm()>0||viewmodel.MaintainEngines()[0].EngineOil>0||viewmodel.MaintainEngines()[0].EngineOil3>0)
        //    viewmodel.Integrity(Number(viewmodel.Integrity()) + 10);
        //if (viewmodel.Integrity() > 100)
        //    viewmodel.Integrity(100);
    }
</script>



</div>



        </div>
        <div class="g-footer">
            <p class="footer-text">copyright © 2004-2015 www.autohome.com.cn All Rights Reserved. 汽车之家 版权所有</p>
        </div>
        <input id="currenturl" name="currenturl" type="hidden" value="NewsTemplateSection1/Edit" />
    </div>

</div>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/json2.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/jquery-1.10.2.min.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/bootstrap.min.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/respond.min.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/jquery.validate.min.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/jquery.validate.unobtrusive.min.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/jquery.artDialog.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/jquery.cookie.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/knockout.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/knockout.mapping.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/knockout.loader.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/common.js'></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/mchnav.js'></script>   
    
    <script type="text/javascript" src="http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/datetextbox.js"></script>
    <script type="text/javascript" src="http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/carpurchasecost.js"></script>  
    <script type="text/javascript" src="/Price/Scripts/News/News.js?v=20150319025308.780"></script>
    <script type="text/javascript" src='http://x.cheshanghui.com.cn/dealer/ics/20150226A/Scripts/News/NewImage.js'></script>
    <script type="text/javascript" src="/Price/Scripts/News/NewsEquipcarGiftPkg.js"></script>


    <script type="text/javascript">
        var comment_content_section2 = "";
        var news_titie = "绅宝D50提供试乘试驾 购车优惠0.8万";
        var news_isPublish = "1";
        var news_sub_titie = "购绅宝D50钜惠0.8万元";
        var news_content = "近日，本店内绅宝D50现车销售，颜色可选，目前购车部分车型可优惠0.80万元，感兴趣的朋友可以到店咨询购买，详情见下表：";
        var news_conclusion = "以上为车型资料信息，本店提供了很多附加增值性服务，感兴趣的朋友欢迎咨询本店资讯详细信息。";
        var news_comment = "";
        var news_bigimagetitle = "";
        var news_hasphone = 1;
        var news_hasaddress = 1;
        //是否使用自动标题。新增的时候默认是使用的，修改的时候按照文章的是否自动生成标题
        var news_IsAutoTitle = 1;
        //是否使用自动模板，默认是自动模板
        var news_IsAutoTemplate = 1;
        //是否商用车
        var news_IsBusinessCar = false;
        var template_section1_init = getInitModel();
        var firstStepContentChanged = true; //默认内容会被改变。

        //文章id
        function GetNewsId() {
            return '26630965';
        }

        //获取页面初始化时的SeriesId
        function getInitSeriesID() {
            return '2791';;
        }

        //获取模板id
        function GetNewsTemplateID() {
            return '12949247';
        }

        //是否发布
        function GetIsPub() {
            return $('#IsPub').val();
        }

        //车系id
        function getSeriesID() {
            return $('.rdoSeries:checked').val();;
        }

        //车系名称
        function GetSeriesName() {
            return $('.rdoSeries:checked').attr('sname');
        }

        //加装车请求URL
        function getEquipCarDetailsUrl() {
            return '/Price/EquipmentCar/GetEquipCar_Packgae_PackageDetails';
        }

        //礼包详情请求URL
        function getGiftPackageDetailsUrl() {
            return '/Price/EquipmentCar/GetPackage_PackageDetails';
        }

        function getCurrentDate() {
            return '2015-03-19';
        }

        function getCheckEuipCarUrl() {
            return '/Price/NewsTemplateSection1/CheckIsLogicalPrice';
        }

        function getBaseUrl() {
            return 'http://ics.autohome.com.cn/Price';
        }
       

        //tip提示内容
        //显示类别的内容 type：0：显示内容 1：隐藏内容  template：0：模板 1：非模板  classId：类别编号
        function showClassInfo(type, template, classId) {
            if (type == 0) {
                if (template == 0) {
                    $("#divClassTemplate" + classId).show(); //模板
                } else {
                    $("#divClass" + classId).show();
                }
            } else {
                if (template == 0) {
                    $("#divClassTemplate" + classId).hide();
                } else {
                    $("#divClass" + classId).hide();
                }
            }
        }

        function getCommonUrl(newsClassId, seriesId, newsId) {
            if (!newsClassId)
                newsClassId = $(".rdoNewsClass:checked").val();
            if (!seriesId)
                seriesId = $(".rdoSeries:checked").val();
            //取消编辑的导航，切换车系意味着发布一篇新资讯
            var url = "/Price/NewsTemplateSection1";

            url += "?classId=" + newsClassId + "&seriesId=" + seriesId;
            //if (GetNewsId() > 0) {
            //    url += "&newsId=" + GetNewsId();
            //}

            return url;
        }


        //模版切换时提示
        function confirmChangeTemplate(classId, isTempalte) {

            var url = '/Price/News/Create';
            url += "?classid=" + classId;
            if (isTempalte == 1 && classId == 2) {
                url = '/Price/NewsTemplateSection1';
            } else if (isTempalte == 1 && classId == 3) {
                url = '/Price/NewCar/index';
            }

            var okFunc = function() {
                window.location.href = url;
            };
            var cancelFunc = function() {}

            showModualDialog(okFunc, cancelFunc, classChangeMsg);
        }


        $(".rdoSeries").bind("click", confirmSwitchSeries);
        $('.intNum').bind("keyup", function() {
            var num = $(this).val();
            var pr = num.replace(/[^\d]/g, "");
            $(this).val(pr);
        });
        $(":checkbox.associatedStore").bind("click", resetMinAndMaxPrice); //关联店铺的更改，需要及时更新该车系的最低报价和最高报价
        $(".newsClasses .u-icon12-wen").hide();


//现金优惠的价格判断
        function priceoffKeyup() {

            var price = $("#priceoff").val();


            if (price.length >= 2 && price.substr(0, 1) == '0' && price.substr(1, 1) != '.') {
                price = price.substr(1, price.length - 1);
            }
            var pattern = /^[0-9]+(.[0-9]{1,2})?$/;
            var pr = price.replace(/[^\d.]/g, "");
            $("#priceoff").val(pr);
            if (!pattern.test(price)) {
                var point = price.indexOf(".");
                if (point > -1) {
                    var iNum = price.substring(0, point).replace(/[^\d]/g, '');
                    var fNum = price.substring(point + 1, point + 3).replace(/[^\d]/g, '');
                    var p = iNum + "." + fNum;
                    $("#priceoff").val(p);

                }
            }

        }

        //三种补贴的价格判断
        function priceKeyup(obj, type) {
            var price = $(obj).val();
            if (price.length >= 2 && price.substr(0, 1) == '0' && price.substr(1, 1) != '.') {
                price = price.substr(1, price.length - 1);
            }
            var pattern = /^[0-9]+(.[0-9]{1,2})?$/;

            var pr = price.replace(/[^\d.]/g, "");

            $(obj).val(pr);

            if (!pattern.test(price)) {
                var point = price.indexOf(".");
                if (point > -1) {
                    var iNum = price.substring(0, point).replace(/[^\d]/g, '');
                    var fNum = price.substring(point + 1, point + 3).replace(/[^\d]/g, '');
                    var p = iNum + "." + fNum;
                    $(obj).val(p);
                }
            }
            if (type == 1) { //店内保险优惠 当Price>0时，chkHasDealerInsurance 必须被选中。
                if (price > 0) {
                    $("#chkHasDealerInsurance").prop("checked", true);
                } else {
                    $("#chkHasDealerInsurance").prop("checked", false);
                }

            }
        }

        function priceKeyPress(obj, type) {
            var price = $(obj).val();
            if (price.length >= 2 && price.substr(0, 1) == '0' && price.substr(1, 1) != '.') {
                price = price.substr(1, price.length - 1);
            }
            var pattern = /^[0-9]+(.[0-9]{2})?$/;

            //   var pr = price.replace(/[^\d.]/g, "");

            //   $(obj).val(pr);

            if (!pattern.test(price)) {
                var point = price.indexOf(".");
                if (point > -1) {
                    var iNum = price.substring(0, point).replace(/[^\d]/g, '');
                    var fNum = price.substring(point + 1, point + 3).replace(/[^\d]/g, '');
                    var p = iNum + "." + fNum;
                    $(obj).val(p);
                }
            }
            if (type == 1) { //店内保险优惠 当Price>0时，chkHasDealerInsurance 必须被选中。
                if (price > 0) {
                    $("#chkHasDealerInsurance").prop("checked", true);
                } else {
                    $("#chkHasDealerInsurance").prop("checked", false);
                }

            }
        }

        function getCheckedDealerIds() {
            var dealerIdArr = [];
            $(".associatedStore:checkbox").each(function(index) {
                if ($(this).is(":checked")) {
                    dealerIdArr.push($(this).val());
                }
            });
            return dealerIdArr.join(",");
        }

        function getInitModel() {
            var model = null;
            if (GetNewsId() > 0) {
                model = {};
                model.Seriesid = getSeriesID();
                model.SeriesName = GetSeriesName();
                model.FactorySubsidyPrice = $('#txtFactorySubsidyPrice').val() == "" ? 0 : $('#txtFactorySubsidyPrice').val(); //厂商补贴价格
                model.ExchangeSubsidyPrice = $('#txtExchangeSubsidyPrice').val(); //置换补贴价格
                model.GovSubsidyPrice = $('#txtGovSubsidyPrice').val() == "" ? 0 : $('#txtGovSubsidyPrice').val(); //政府补贴价格
                model.AllowancePrice = $('#txtAllowancePrice').val() == "" ? 0 : $('#txtAllowancePrice').val(); //惠民补贴价格
                model.LicenseTaxPrice = $('#LicenseTax').val(); //上牌费
                model.OtherPrice = $('#OtherPrice').val() == "" ? 0 : $('#OtherPrice').val(); //其它费用
                model.VehicleTaxPrice = 0; //车船税
                model.CommercialInsurancePrice = 0; //商业险价格
                model.CompulsoryInsurancePrice = 0; //交强险价格
                model.PurchaseTaxPrice = 0; //购置税
                model.PurchaseTax = $('#selPurchaseTax').val(); //赠送购置税百分比
                model.CompulsoryInsurance = $('#selCompulsoryInsurance').val(); //赠送交强险年数
                model.CommercialInsurance = $('#selCommercialInsurance').val(); //赠送商业险年数
                model.InsuranceDiscount = $('#txtInsuranceDiscount').val(); //保险优惠金额
                model.HasDealerInsurance = ($('#chkHasDealerInsurance').attr('checked') == false ? '0' : '1'); //必须店内上保险


                model.InventoryState = $('input[name=inventoryState]:checked').val();
                model.IsPriceOff = $('input[name=IsPriceOff]:checked').val();
                model.PriceOff = $('#priceoff').val();
                model.StartDate = $('#txtstarttime').val();
                model.EndDate = $('#txtendtime').val();
                model.IsRecommend = $('#chk_isRecommend').prop('checked'); //是否推荐
                model.MemberFocus = $('#chk_memberFocus').prop('checked'); //添加至会员页焦点图
                model.IsBullet = $('#bullet').prop('checked') == true; //公告
                model.DealerIds = getCheckedDealerIds();

                model.HasGiftPackage = GetPackageIds() != '' ? true : false;
                model.HasEquipCar = GetEquipCarIds() != '' ? true : false;
                //设置加装车和礼包
                model.PackAgeIds = GetPackageIds(); //关联礼包id
                model.EquipCarIds = GetEquipCarIds(); //关联加装车id

            }
            return model;
        }
    </script>
    <!--第二页的Javascript-->
    <script type="text/javascript">
        //初始化第二节数据
        viewmodel = new Template();
        ko.applyBindings(viewmodel, document.getElementById("section2"));
    </script>
<script>
    $(function(){
        function isFix(){
            var wid = $(".g-maincontainer").innerWidth()-40;
            if($(window).scrollTop() > 185){
                $('.m-progress').css({"width":wid,"position":"absolute","top":$(window).scrollTop()-135,"left":"0","z-index":"10"}).siblings(".m-crumbs").css("margin-bottom","54px");
            }else{
                $('.m-progress').css({"position":"static","width":"auto"}).siblings(".m-crumbs").css("margin-bottom","0");
            }
        }
        isFix();
        $(window).bind('scroll',isFix);
        $(window).bind('resize',isFix);
    });
</script>


    

</body>
</html>